(on)dblclick event is a native javascript event, not a jquery's event
Dblclick event is not consistent across browsers, see this ticket 3 years old but still valid in some way: http://bugs.jquery.com/ticket/7876 even now sequence in IE10 is the same as FF/Chrome/Safari but as you noted it, there are still some bugs.
As a workaround, you could use this snippet instead of dblclick event:
DEMO with custom dblclick
$('#test').on('click', function(event){
var t = this;
if (!t.clicks) t.clicks = 0;
++t.clicks;
if (t.clicks === 2) {
t.clicks = 0;
//here the kind of dclclick is fired ...
$(t).css({'background-color' : "red"});
}
setTimeout(function () {
t.clicks = 0
}, 500);//duration value can be change depending of your wishes
});
An other workaround could be to bind/unbind dblclick event on mousedown/mouseenter/mouseleave (hover) handlers, like that:
DEMO with mousedown/mouseenter/mouseleave
$('#test').hover(function () {
$(this).on('mousedown.cust', function () {
$(this).on('dblclick.cust', function () {
$(this).css({
'background-color': "red"
});
});
});
}, function () {
$(this).off('mousedown.cust dblclick.cust');
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…