Dragging text prevents mouseup from trigging - jav

2019-08-05 16:06发布

问题:

I'm experiencing an issue with chromes click behavior. There are cases (havnt been able to isolate the exact conditions, maybe dragging, dblclick, too quick... no idea) chrome will stop triggering the onmouseup event and the tabs wont slide anymore Tested the issue on ff and ie, which work fine. I did however notice that there is a workaround by setting the return value to false. This isnt useful on a website as this would disable any clicking action... I cant seem to find anybody else with this exact same issue. This is the page: JS Fiddle

Note 1: If the animation function is called directly (overriding any click events) no issues occur. Hence, I believe its an onmouse issue in chrome Note 2: user824294 explained he believes its got to do with dragging text. Ive sat at this issue for a couple evenings now. Help much appreciated :)

回答1:

//document.ondragend = FlickOut; // activate flick behaviour
document.ondragend = function(e)
{
    document.getElementById("dbg").innerHTML += "mouseup -\n";
    FlickOut(e);
    return true;
}; // activate flick behaviour

Add this below the document.onmouseup event function.


Here is the forked JS Fiddle solution.


Update


Chrome has a bug at failing to trigger onmouseup when clicking at the scrollbar. Onmousedown works, but no onmouseup event.

Here is the link: Issue 14204: Scrollbar triggers onmousedown, but fails to trigger onmouseup.

The chrome bug is fixed as of February 26, 2013.