嗨!
有什么方法可以确定当前使用 jQuery 悬停的元素(通过鼠标)?
请参阅 .mouseover() 的文档。
是的:
$("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)
是 acually 悬停在这里的元素是一个向您展示它是如何工作的示例:http:
//jsfiddle.net/hwhe7/
第二个示例将您悬停在身体上的所有元素组成一个数组:http: //jsfiddle.net/mdH7L/