ontouchstart null check in addEventListeners
authorJJ Allaire <jj@rstudio.org>
Thu, 14 Feb 2013 10:26:46 +0000 (05:26 -0500)
committerJJ Allaire <jj@rstudio.org>
Thu, 14 Feb 2013 10:26:46 +0000 (05:26 -0500)
js/reveal.js

index d315c897e858616823a257fce0fc4784e10eeb7c..7572569b3abb01bb75731590e2d9cd52dd5674b4 100644 (file)
@@ -408,7 +408,7 @@ var Reveal = (function(){
                }
 
                if ( config.controls && dom.controls ) {
-                       var actionEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
+                       var actionEvent = 'ontouchstart' in window && window.ontouchstart != null ? 'touchstart' : 'click';
                        dom.controlsLeft.forEach( function( el ) { el.addEventListener( actionEvent, onNavigateLeftClicked, false ); } );
                        dom.controlsRight.forEach( function( el ) { el.addEventListener( actionEvent, onNavigateRightClicked, false ); } );
                        dom.controlsUp.forEach( function( el ) { el.addEventListener( actionEvent, onNavigateUpClicked, false ); } );