From 20d09d36583d391da9ebff085774454338931111 Mon Sep 17 00:00:00 2001 From: Changyu Geng Date: Wed, 14 Aug 2013 12:57:36 +0800 Subject: [PATCH] fix the css zoom property of body issue --- jquery.ui.touch-punch.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/jquery.ui.touch-punch.js b/jquery.ui.touch-punch.js index 2766f41..a5faaca 100755 --- a/jquery.ui.touch-punch.js +++ b/jquery.ui.touch-punch.js @@ -39,6 +39,9 @@ var touch = event.originalEvent.changedTouches[0], simulatedEvent = document.createEvent('MouseEvents'); + var zoomRatio=b("body").css("zoom"); + if(isNaN(zoomRatio))zoomRatio=1; + // Initialize the simulated mouse event using the touch event's coordinates simulatedEvent.initMouseEvent( simulatedType, // type @@ -46,10 +49,10 @@ true, // cancelable window, // view 1, // detail - touch.screenX, // screenX - touch.screenY, // screenY - touch.clientX, // clientX - touch.clientY, // clientY + touch.screenX / zoomRatio, // screenX + touch.screenY / zoomRatio, // screenY + touch.clientX / zoomRatio, // clientX + touch.clientY / zoomRatio, // clientY false, // ctrlKey false, // altKey false, // shiftKey @@ -157,4 +160,4 @@ _mouseInit.call(self); }; -})(jQuery); \ No newline at end of file +})(jQuery);