fixed issue with links on touch devices (tap wasn't working)
authorHakim El Hattab <hakim.elhattab@gmail.com>
Thu, 23 Jun 2011 07:05:53 +0000 (09:05 +0200)
committerHakim El Hattab <hakim.elhattab@gmail.com>
Thu, 23 Jun 2011 07:05:53 +0000 (09:05 +0200)
js/slideshow.js

index 8165a40b21a89df1da56fb87b4d7d9e549f0eb19..bd6ae28e9158e96a4eaf6025207ff1b1823c6087 100644 (file)
@@ -104,9 +104,13 @@ var Slideshow = (function(){
         * @param {Object} event
         */
        function onDocumentTouchStart( event ) {
-               
                // We're only interested in one point taps
-               if (event.touches.length == 1) {
+               if (event.touches.length === 1) {
+                       // Never prevent taps on anchors and images
+                       if( event.target.tagName.toLowerCase() === 'a' || event.target.tagName.toLowerCase() === 'img' ) {
+                               return;
+                       }
+                       
                        event.preventDefault();
                        
                        var point = {