在MouseDown事件中,是否有可能取消所产生的点击事件?或传递的信息呢? [英] In the mousedown event, is it possible to cancel the resulting click event? or pass info to it?

查看:512
本文介绍了在MouseDown事件中,是否有可能取消所产生的点击事件?或传递的信息呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我需要能够通过鼠标按下事件取消click事件神秘的原因。

for arcane reasons I need to be able to cancel the click event via the mousedown event.

简单;我在MouseDown事件中创建上下文菜单,但是,当用户点击右键菜单应该消失在页面上。

Briefly; I am creating a context menu in the mousedown event, however, when the user clicks on the page the context menu should disappear.

我不能够在该方案中通过点击使用鼠标按下事件,我希望用户能够点击链接菜单内(一个完整的点击永远不会传播到< A&GT ; 基于菜单元素)。

I am not able to use the mousedown event over the click in that scenario as I want the user to be able to click links inside the menu ( a full click would never travel to the <a> based menu elements ).

如果它是任何帮助,jQuery的均可适用。

If it is any help, jQuery can be applied.

我想要么能够prevent click事件从最初的mousedown内发生的事情,还是能够(通过originalEvent或其他方式)将信息传递给Click事件。

I would like to either be able to prevent the click event from happening from within the initial mousedown, or be able to pass information to the click event (via originalEvent or otherwise).

TIA

推荐答案

似乎是不可能的,无论是FF也不歌剧剪掉取消即将举行的点击时$ P $在pvented 鼠标按下和/或鼠标松开(如侧面说明:点击鼠标松开后,被分派,如果某些条件满足)。测试用例: http://jsfiddle.net/ksaeU/

Seems to be impossible, neither FF nor Opera didnt cancel upcoming click when prevented in mousedown and/or mouseup (as side note: click is dispatched after mouseup if certain conditions met). testcase: http://jsfiddle.net/ksaeU/

这篇关于在MouseDown事件中,是否有可能取消所产生的点击事件?或传递的信息呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆