diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-09-10 11:25:19 +0200 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-09-10 11:25:19 +0200 |
commit | 0d37757f3f34dff5840eff6bd5ac6735938234a6 (patch) | |
tree | a1e5a3eccce002a602084850e3d848d259d79156 /js | |
parent | be7545da1ab3d0739ffd65e04956761b4cd36fd8 (diff) | |
download | fosdem-2018-presentation-0d37757f3f34dff5840eff6bd5ac6735938234a6.tar fosdem-2018-presentation-0d37757f3f34dff5840eff6bd5ac6735938234a6.tar.gz |
modifications to #951
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/js/reveal.js b/js/reveal.js index b1a20cc..29c2df0 100644 --- a/js/reveal.js +++ b/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 -------------------------------// @@ -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; @@ -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 ) { @@ -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 ------------------------// |