jQuery Plugin To Bind Single Click Event To Element - singleclick.js
File Size: | 2.83 KB |
---|---|
Views Total: | 1289 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
Just another lightweight jQuery plugin that binds a 'single click' event to prevent user from double clicking on a specific element. Very useful to distinguish between single and double click events.
How to use it:
1. Link jQuery library and the jQuery singleclick.js script to your html page.
<script src="//code.jquery.com/jquery.min.js"></script> <script src="INHANCE_singleclick.jquery.js"></script>
2. Attach the plugin to a specific element.
$('#myBtn').on('sclick', function (evt) { evt.preventDefault(); });
3. Optionally, you are able to set delay time in milliseconds as this:
INHANCE_singleclick.set({ delay: 300 });
Change log:
2017-11-04
- able to set delay dynamically
2017-05-20
- added preventDefault() for touch devices
2017-05-05
- added preventDefault() for touch devices
2017-02-21
- refactorized to make use of $.event.special
2017-02-18
- added 'tap' event.
2017-01-10
- added 'target' parameter and changed method signatures
This awesome jQuery plugin is developed by cgopia94. For more Advanced Usages, please check the demo page or visit the official website.