summaryrefslogtreecommitdiff
path: root/js/vendor/jquery-nodoubletapzoom.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-05-08 16:34:43 -0400
committerJulie Lala <jules@okfoc.us>2014-05-08 16:34:43 -0400
commit3caac3e80e3a0eef2c481698de777a308d275d54 (patch)
tree42d6a60c9bce54a57648d8538407b89913596a0a /js/vendor/jquery-nodoubletapzoom.js
parent4df42cb4c3243ba2320d48ea45a08b3239df92dd (diff)
grunt stuffffff
Diffstat (limited to 'js/vendor/jquery-nodoubletapzoom.js')
-rw-r--r--js/vendor/jquery-nodoubletapzoom.js19
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