使用jQuery获取悬停链接

时间:2010-06-15 08:48:33

标签: jquery hover mousehover

Hy那里!

有没有办法确定当前使用jQuery(通过鼠标)悬停哪个元素?

2 个答案:

答案 0 :(得分:0)

请参阅.mouseover()的文档。

JQuery API MouseOver

答案 1 :(得分:0)

是的:

$("div.hover").hover( //select the elements you want to check the hover on, in this case i check all divs with the class hover
   function(){ $(this).dosomething() },
   function(){ $(this).dosomethingelse() }
)

$(this)是经常徘徊的元素 这是一个示例,向您展示它是如何工作的: http://jsfiddle.net/hwhe7/

第二个示例生成了您身体上悬停的所有元素的数组: http://jsfiddle.net/mdH7L/

相关问题