diff options
Diffstat (limited to 'js/vendor/jquery-nodoubletapzoom.js')
| -rw-r--r-- | js/vendor/jquery-nodoubletapzoom.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/js/vendor/jquery-nodoubletapzoom.js b/js/vendor/jquery-nodoubletapzoom.js new file mode 100644 index 0000000..3e45c82 --- /dev/null +++ b/js/vendor/jquery-nodoubletapzoom.js @@ -0,0 +1,19 @@ +;(function($) { + var IS_IOS = /iphone|ipad/i.test(navigator.userAgent); + $.fn.nodoubletapzoom = function() { + if (IS_IOS) + $(this).bind('touchstart', function preventZoom(e) { + var t2 = e.timeStamp + , t1 = $(this).data('lastTouch') || t2 + , dt = t2 - t1 + , fingers = e.originalEvent.touches.length; + $(this).data('lastTouch', t2); + if (!dt || dt > 500 || fingers > 1) return; // not double-tap + + e.preventDefault(); // double tap - prevent the zoom + // also synthesize click events we just swallowed up + $(this).trigger('click').trigger('click'); + }); + return this; + }; +})(jQuery);
\ No newline at end of file |
