modifications to #951
This commit is contained in:
parent
be7545da1a
commit
0d37757f3f
1 changed files with 17 additions and 11 deletions
28
js/reveal.js
28
js/reveal.js
|
@ -3781,6 +3781,21 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the target element prevents the triggering of
|
||||||
|
* swipe navigation.
|
||||||
|
*/
|
||||||
|
function isSwipePrevented( target ) {
|
||||||
|
|
||||||
|
while( target && typeof target.hasAttribute === 'function' ) {
|
||||||
|
if( target.hasAttribute( 'data-prevent-swipe' ) ) return true;
|
||||||
|
target = target.parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------//
|
// --------------------------------------------------------------------//
|
||||||
// ----------------------------- EVENTS -------------------------------//
|
// ----------------------------- EVENTS -------------------------------//
|
||||||
|
@ -3954,7 +3969,7 @@
|
||||||
*/
|
*/
|
||||||
function onTouchStart( event ) {
|
function onTouchStart( event ) {
|
||||||
|
|
||||||
if(preventSwipe(event.target)) return true;
|
if( isSwipePrevented( event.target ) ) return true;
|
||||||
|
|
||||||
touch.startX = event.touches[0].clientX;
|
touch.startX = event.touches[0].clientX;
|
||||||
touch.startY = event.touches[0].clientY;
|
touch.startY = event.touches[0].clientY;
|
||||||
|
@ -3979,7 +3994,7 @@
|
||||||
*/
|
*/
|
||||||
function onTouchMove( event ) {
|
function onTouchMove( event ) {
|
||||||
|
|
||||||
if(preventSwipe(event.target)) return true;
|
if( isSwipePrevented( event.target ) ) return true;
|
||||||
|
|
||||||
// Each touch should only trigger one action
|
// Each touch should only trigger one action
|
||||||
if( !touch.captured ) {
|
if( !touch.captured ) {
|
||||||
|
@ -4271,15 +4286,6 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function preventSwipe(target) {
|
|
||||||
while( target && typeof target.hasAttribute === 'function' ) {
|
|
||||||
if(target.hasAttribute('prevent-swipe')) return true;
|
|
||||||
target = target.parentNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------//
|
// --------------------------------------------------------------------//
|
||||||
// ------------------------ PLAYBACK COMPONENT ------------------------//
|
// ------------------------ PLAYBACK COMPONENT ------------------------//
|
||||||
|
|
Loading…
Reference in a new issue