Bind to the multiclick
event, a custom DOM-like event generated using jQuery's Special Events API.
The multiclick
event triggers when the user clicks within the bound element a configurable number of times.
Have you ever wished that browsers threw an event when a user clicked an element a certain number of times? (No? OK, me neither... but this made for a good demonstration.) If you are [or can be] using jQuery 1.7+, then this simple jQuery extension can grant that wish for you!
Check the jQuery Plugins Registry for the latest published version of this plugin!
You can also download the production version or the development version from GitHub.
In your web page:
<script src="jquery.js"></script>
<script src="dist/jquery.multiclick.min.js"></script>
<script>
jQuery(selector).on("multiclick", { clicks: 3 }, callbackFunc);
</script>
// click, click, click, multiclick
jQuery(selector).on("multiclick", { clicks: 3 }, callbackFunc);
// click, click, click, click, click, multiclick
jQuery(selector).on("multiclick", { clicks: 5 }, callbackFunc);
Works 100% with jQuery versions:
- 1.7.x
- 1.8.x
- 1.9.x
Untested jQuery versions:
- Anything below 1.7.x (incompatible jQuery Special Events API)
- 2.0.0b1
(Coming soon)
- 0.5.3: Published to the jQuery Plugins Registry on 2013-02-14.
- Initial release, plus filename updates.