Skip to content

Instantly share code, notes, and snippets.

@Victa
Forked from ncr/README
Created December 30, 2011 11:43
Show Gist options
  • Save Victa/1539457 to your computer and use it in GitHub Desktop.
Save Victa/1539457 to your computer and use it in GitHub Desktop.
jquery.single_double_click
jQuery.fn.single_double_click = function(single_click_callback, double_click_callback, timeout) {
return this.each(function(){
var clicks = 0;
$(this).click(function(){
clicks ++;
if (clicks == 1) {
setTimeout(function(){
if(clicks == 1) {
single_click_callback();
} else {
double_click_callback();
}
clicks = 0;
}, timeout || 300);
}
});
});
}
@asdf072
Copy link

asdf072 commented Feb 25, 2013

For anyone looking, I forked a hack that allows the use of this AND .draggable().

@chetanraj
Copy link

Made my life easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment