diff --git a/jquery.ui.touch-punch.js b/jquery.ui.touch-punch.js index 16ce41d..1f52484 100755 --- a/jquery.ui.touch-punch.js +++ b/jquery.ui.touch-punch.js @@ -35,28 +35,32 @@ return; } + if ($(event.target).is("input") || $(event.target).is("textarea") || $(event.target).is("button")) { + return; + } + event.preventDefault(); var touch = event.originalEvent.changedTouches[0], simulatedEvent = document.createEvent('MouseEvents'); - + // Initialize the simulated mouse event using the touch event's coordinates simulatedEvent.initMouseEvent( simulatedType, // type - true, // bubbles - true, // cancelable - window, // view - 1, // detail - touch.screenX, // screenX - touch.screenY, // screenY - touch.clientX, // clientX - touch.clientY, // clientY - false, // ctrlKey - false, // altKey - false, // shiftKey - false, // metaKey - 0, // button - null // relatedTarget + true, // bubbles + true, // cancelable + window, // view + 1, // detail + touch.screenX, // screenX + touch.screenY, // screenY + touch.clientX, // clientX + touch.clientY, // clientY + false, // ctrlKey + false, // altKey + false, // shiftKey + false, // metaKey + 0, // button + null // relatedTarget ); // Dispatch the simulated event to the target element @@ -145,7 +149,7 @@ * original mouse event handling methods. */ mouseProto._mouseInit = function () { - + var self = this; // Delegate the touch handlers to the widget's element @@ -163,7 +167,7 @@ * Remove the touch event handlers */ mouseProto._mouseDestroy = function () { - + var self = this; // Delegate the touch handlers to the widget's element @@ -177,4 +181,4 @@ _mouseDestroy.call(self); }; -})(jQuery); \ No newline at end of file +})(jQuery);