jQuery Plugin To Handle Single Click Event - singleClick

File Size: Unknown
Views Total: 776
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Handle Single Click Event - singleClick

singleClick is a jQuery plugin for differentiating single click and double click that always fires single click event unless you double click within a specific time.

How to use it:

1. Just download & include the jquery.singleclick.js file after the jQuery library as shown in the code snippet below and you're done.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="jquery.singleclick.js"></script>

2. Bind the single click to any element and do something as per your need.

$('#demo').on('singleclick', function(e) {
  // do something
});

3. Default options available.

// Follow the 'click' event flow for direct binding.
bindType: 'click',

// Follow the 'click' event flow for delegated binding.
delegateType: 'click',

// Maximum time between 2 clicks so they are considered a double click.
timeout: 250,

// The plugin will save data on an element (using $.data) under this property.
dataProp: 'singleclicktimeout',

This awesome jQuery plugin is developed by omriyariv. For more Advanced Usages, please check the demo page or visit the official website.