如何先找到mouseclick
,如果没有点击,然后再寻找mouseover
?
我在两个鼠标事件中实现了两种类型的功能。一个在 mouseover
中,另一个在 mouseclick
中。
如果我点击,我需要首先触发 mouseclick
事件,而不是 mouseover
事件。我知道默认情况下,首先触发 mouseover
。但如何实现这种场景。
代码:
$('.example').mouseover(function (event) {
// ...
//mouse over logic
// ...
});
$('.example').mouseclick(function (event) {
// ...
//mouse click logic
// ...
});
注意:
Alos, I tried with timer, set control flags but in each try, only
mouseover
is triggerd first. Bothmouseover
andmouseclick
has different functionalities. If both are same, then we can put in common. But, here the case is different. I had also searched over the net for this. But nothing helped till now. Thanks.
最佳答案
在点击事件中定义鼠标悬停事件怎么样?
示例:
$('.example').mouseclick(function (event) {
// ...
//mouse click logic
// ...
$(body).bind('onmouseover', '.example'){
// mouseover logic
}
});
我没有经过严格的测试...
关于javascript - 如何首先找到鼠标点击,如果没有点击,然后再寻找鼠标悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41142501/