Explorar o código

config option for disabling touch navigation (closes #299)

hakimel %!s(int64=11) %!d(string=hai) anos
pai
achega
e62b0f8795
Modificáronse 2 ficheiros con 16 adicións e 7 borrados
  1. 15 6
      js/reveal.js
  2. 1 1
      js/reveal.min.js

+ 15 - 6
js/reveal.js

@@ -34,6 +34,9 @@ var Reveal = (function(){
 			// Vertical centering of slides
 			center: true,
 
+			// Enables touch navigation on devices with touch input
+			touch: true,
+
 			// Loop the presentation
 			loop: false,
 
@@ -375,12 +378,15 @@ var Reveal = (function(){
 	 */
 	function addEventListeners() {
 
-		document.addEventListener( 'touchstart', onDocumentTouchStart, false );
-		document.addEventListener( 'touchmove', onDocumentTouchMove, false );
-		document.addEventListener( 'touchend', onDocumentTouchEnd, false );
 		window.addEventListener( 'hashchange', onWindowHashChange, false );
 		window.addEventListener( 'resize', onWindowResize, false );
 
+		if( config.touch ) {
+			document.addEventListener( 'touchstart', onDocumentTouchStart, false );
+			document.addEventListener( 'touchmove', onDocumentTouchMove, false );
+			document.addEventListener( 'touchend', onDocumentTouchEnd, false );
+		}
+
 		if( config.keyboard ) {
 			document.addEventListener( 'keydown', onDocumentKeyDown, false );
 		}
@@ -407,12 +413,15 @@ var Reveal = (function(){
 	function removeEventListeners() {
 
 		document.removeEventListener( 'keydown', onDocumentKeyDown, false );
-		document.removeEventListener( 'touchstart', onDocumentTouchStart, false );
-		document.removeEventListener( 'touchmove', onDocumentTouchMove, false );
-		document.removeEventListener( 'touchend', onDocumentTouchEnd, false );
 		window.removeEventListener( 'hashchange', onWindowHashChange, false );
 		window.removeEventListener( 'resize', onWindowResize, false );
 
+		if( config.touch ) {
+			document.removeEventListener( 'touchstart', onDocumentTouchStart, false );
+			document.removeEventListener( 'touchmove', onDocumentTouchMove, false );
+			document.removeEventListener( 'touchend', onDocumentTouchEnd, false );
+		}
+
 		if ( config.progress && dom.progress ) {
 			dom.progress.removeEventListener( 'click', preventAndForward( onProgressClick ), false );
 		}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
js/reveal.min.js


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio