mobile-monkey simulates mouse events on touchscreens in the same way jQuery UI Touch Punch does,
only mobile-monkey patches jQuery's .on
handler to provide a general patch for your entire application.
You may notice a delay on your site when you use a touchscreen. This is because nearly all touchscreen
devices have a 300ms delay between firing the touchstart
event and firing the click
event.
Use this patch to invoke your handler earlier, providing a great experience on touch devices.
mobile-monkey even provides the necessary touch capabilities for jQuery UI!
-
mobile-monkey currently only supports
click
events in non-delegation handlers. -
mobile-monkey will not patch handlers bound to
document
,html
, orbody
. Binding mobile-monkey to these elements prevents the user from scrolling with their touchscreen. -
mobile-monkey does not dispatch
click
when the original touch target is aninput
ortextarea
. This is because by the time the click event has fired, the keyboard has appeared and the event x, y coordinates are no longer correct. This will hopefully be solved in the future -
This is a monkey patch; a hack. Soon, Pointer events will be regularly consumable without awkward polyfills that require you to rewrite large portions of your site, and we can stop with this nonsense.
-
Grab
jquery.mobile-monkey.js
from the repository and add it to your project. -
Include jQuery and mobile-monkey on your page.
<script src="//code.jquery.com/jquery.min.js"></script> <script src="jquery.mobile-monkey.js"></script>
-
And you're set! Your
click
handlers will now get fired much sooner, giving touchscreen users a much more pleasant experience on your website.
Tested on iPad, iPhone, Android and other touch-enabled mobile devices.
Thanks to Dave Furfero for making a great and useful plugin!
Visit the official Touch Punch website.
mobile-monkey is a derivative work of jQuery UI Touch Punch and is dual licensed under the MIT and GPLv2 licenses.
Original copyright: Copyright 2011–2014, Dave Furfero