A bare-bones jQuery plugin to allow for callback on double tap and single tap, with threshold selection.
plugins.getdans.info/one-two-tap
Download from GitHub
jQuery
<script>
$(document).ready(function(){
$('.click-container').onetwotap({
callback: function(){ /* Do Something */ }
});
});
</script>
one-two-tap is meant to be used with a callback. It's nothing without your input. You can set a threshold where, when the window width is above it, a single click/tap will fire the callback and, when the window width is below or equal to it, a double click/tap will fire it. You can also set a single click/tap callback for when the window width is below the threshold.
Options | Definition |
---|---|
threshold |
Below, callback will fire on double tap/click. Above, callback will fire on single. default: 500 |
callback |
function(){} |
oneTapCallback |
function(){} Will only fire on single tap/click when window width is less than or equal to the threshold. |