Skip to content

Commit

Permalink
Add ability to prevent swipe for specific elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Calyhre committed Jun 18, 2014
1 parent e4761d3 commit 4e70cf8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3482,6 +3482,8 @@
*/
function onTouchStart( event ) {

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

touch.startX = event.touches[0].clientX;
touch.startY = event.touches[0].clientY;
touch.startCount = event.touches.length;
Expand All @@ -3505,6 +3507,8 @@
*/
function onTouchMove( event ) {

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

// Each touch should only trigger one action
if( !touch.captured ) {
onUserInput( event );
Expand Down Expand Up @@ -3786,6 +3790,15 @@

}

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 4e70cf8

Please sign in to comment.