diff options
author | Calyhre <charley.david@wopata.com> | 2014-06-18 14:18:08 +0200 |
---|---|---|
committer | Calyhre <charley.david@wopata.com> | 2014-06-18 14:18:41 +0200 |
commit | 4e70cf8126e7e6bd3667479efeecc348dec7e6c0 (patch) | |
tree | 82dbfe3a19d68e5f20adfbadb02c76614c144c40 /js | |
parent | e4761d3a37a5fc3a9e11e22ae12435843ca04416 (diff) | |
download | perl-software-in-gnu-guix-4e70cf8126e7e6bd3667479efeecc348dec7e6c0.tar perl-software-in-gnu-guix-4e70cf8126e7e6bd3667479efeecc348dec7e6c0.tar.gz |
Add ability to prevent swipe for specific elements
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js index 6d98679..b4cb17f 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -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; @@ -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 ); @@ -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 ------------------------// |