How do I check if the mouse is over an element in jQuery?

前端 未结 24 2459
不思量自难忘°
不思量自难忘° 2020-11-22 08:10

Is there a quick & easy way to do this in jQuery that I\'m missing?

I don\'t want to use the mouseover event because I\'m already using it for something else. I

24条回答
  •  轮回少年
    2020-11-22 09:15

    JUST FYI for future finders of this.

    I made a jQuery plugin that can do this and a lot more. In my plugin, to get all elements the cursor is currently hovered over, simply do the following:

    $.cursor("isHover"); // will return jQ object of all elements the cursor is 
                         // currently over & doesn't require timer
    

    As I mentioned, it also has alot of other uses as you can see in the jsFiddle found here

提交回复
热议问题