Skip to content

Commit

Permalink
modifications to #951
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Sep 10, 2015
1 parent be7545d commit 0d37757
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------------------------//
Expand Down Expand Up @@ -3954,7 +3969,7 @@
*/
function onTouchStart( event ) {

if(preventSwipe(event.target)) return true;
if( isSwipePrevented( event.target ) ) return true;

touch.startX = event.touches[0].clientX;
touch.startY = event.touches[0].clientY;
Expand All @@ -3979,7 +3994,7 @@
*/
function onTouchMove( event ) {

if(preventSwipe(event.target)) return true;
if( isSwipePrevented( event.target ) ) return true;

// Each touch should only trigger one action
if( !touch.captured ) {
Expand Down Expand Up @@ -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 ------------------------//
Expand Down

0 comments on commit 0d37757

Please sign in to comment.