2

我在绑定 mouseover mouseon 事件时遇到问题。

我可以用 off 来解绑它们

$('.overview li a img').off('mouseover mouseon');

但似乎不起作用。

$('.overview li a img').on('mouseover mouseon');

有什么建议么?

4

2 回答 2

6

没有mouseon事件。有:

此外,您应该使用处理函数来绑定事件:

$(".overview li a img").on("mouseover", function() {
    console.log("Mouse is over");
});

这是每次触发事件时执行的函数。

于 2012-10-21T20:09:20.700 回答
0
$('.overview li a img').on({'mouseover mouseenter':function(event){
  alert("hello");
}},null,null);

或者

$('.overview li a img').on({'mouseover':function(event){
  alert("hello")}, 
  'mouseenter':function(event){
  alert("world");
}},null,null);

应该可以工作,因为 .on() 函数需要一个函数来绑定。

于 2012-10-21T20:13:50.907 回答