Dragging text prevents mouseup from trigging - javascript - chrome

天涯浪子 提交于 2020-01-05 08:10:14

问题


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.



来源:https://stackoverflow.com/questions/8900794/dragging-text-prevents-mouseup-from-trigging-javascript-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!