Whenever a mousedown or mouseup handler is attached to an element the dblclick cannot be attached (won't work if attached), though this seems fair enough is there any way to reinstate a dblclick functionality without rewriting it from scratch (sigh...) Or am I missing something about events propagation?
It works - place this code in Firebug on this very page and you'll see it working (try double clicking on the text of your question):
($('.post-text')
.mousedown(function () { console.log('down'); })
.mouseup(function () { console.log('up'); })
.dblclick(function () { console.log('dbclick'); }));
Don't have Firebug? Go grab it, I'll wait!
The event.detail parameter will count how many consecutive clicks you had so its possible to use that to detect that a double click has happened.
$('#mybutton').on('click',function(e) {
console.log("User left clicked!"); // do select code
if (e.button == 0 && e.detail == 2) {
console.log("User left doubleclicked!"); // do action code
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With