拖动文本可防止触发 mouseup - javascript - chrome

发布于 2024-12-27 10:21:12 字数 391 浏览 1 评论 0原文

我遇到了 Chrome 点击行为问题。在某些情况下(无法隔离确切的条件,可能是拖动、双击、太快...不知道)chrome 将停止触发 onmouseup 事件,并且选项卡将不再滑动 在ff和ie上测试了这个问题,效果很好。然而我确实注意到有一个解决方法,可以将返回值设置为 false。这在网站上没有用,因为这会禁用任何点击操作...我似乎找不到其他人遇到同样的问题。 这是页面: JS Fiddle

注1:如果直接调用动画函数(覆盖任何点击事件)没有问题发生。因此,我相信这是 Chrome 中的鼠标问题 注 2:user824294 解释说,他认为这与拖动文本有关。我已经在这个问题上讨论了几个晚上了。非常感谢帮助:)

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 :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你丑哭了我 2025-01-03 10:21:12
//document.ondragend = FlickOut; // activate flick behaviour
document.ondragend = function(e)
{
    document.getElementById("dbg").innerHTML += "mouseup -\n";
    FlickOut(e);
    return true;
}; // activate flick behaviour

将其添加到 document.onmouseup 事件函数下方。

这是分叉的 JS Fiddle 解决方案。

更新

Chrome 存在点击滚动条时无法触发 onmouseup 的错误。 Onmousedown 有效,但没有 onmouseup 事件。

以下是链接:
问题 14204:滚动条触发 onmousedown,但无法触发 onmouseup。

chrome 错误已于 2013 年 2 月 26 日修复。

//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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文