jTap - additional event for jQuery processing touching to screen on touch devices.
Those who are faced with adaptation of web-based applications for mobile devices knows that the event "click" is triggered with a delay of 300ms, observe which not very pleasant. In addition, click on non-delegated place of document will not work. To solve these problems and was designed by jQuery Tap Event.
Include the plugin file on the page:
<script src="jquery.tap.js"></script>
and then, after initialization, can set handler as follows:
$('selector').tap(handler);
$('selector').on('tap', handler);
Note: if using "tap" method, you can check the existence of him:
$.isFunction($.fn.tap);
and even protect themselves in so doing:
var clickEvent = $.isFunction($.fn.tap) ? 'tap' : 'click';
$('selector')[clickEvent](handler);
But, of course, better to just use delegation event by means of jQuery method .on('tap', handler)
Note: A noteworthy feature of plugin is a versatility. No matter where you are using the "tap" event : on a device with a touch screen or on a desktop computer - the handler will be executed disparately.
Version 0.2.9, June 2, 2014:
- fixed an issue #2: undelegate event works incorrect.
Version 0.2.8, May 27, 2014:
- was removed the checking of "ontouchstart" in document, because newest versions of browsers contains this property in document for any format of the computer;
- the library was oriented for jQuery 1.6 or higher.
Version 0.2.7, March 17, 2014:
- added support of jQuery >= 1.4.x
Version 0.2.6, March 14, 2014:
- made the code refactoring;
- updated the license and demonstration.
Version 0.2.5, November 17, 2013:
- fixed an issue #1: method preventdefault doesn't worked, because the tap event constructed by mousedown/mouseup or touchstart/touchend events and they can not to be prevented.
Version 0.2.4, August 22, 2013:
- first public version.
- Vasily Asakasinsky (asakasinsky), for the bug report #1 - November 17, 2013.
- egorogl, for the bug report #2 - May 29, 2014.
jTap is licensed under the MIT license.
- Demonstration: http://firstvector.org/jTap
- Plugin page: http://plugins.jquery.com/jTap/
- Presentational publication (ru): http://habrahabr.ru/post/191078/