jQuery hover not triggered when element is programatically moved under the mouse

后端 未结 4 624
星月不相逢
星月不相逢 2021-01-02 22:16

I have an image with a hover effect (higher opacity when mouse is over it). It works as desired when the mouse moves in and out.

However, the image itself is moving

4条回答
  •  日久生厌
    2021-01-02 22:51

    You could manually test to see if the mouse is in the image when you move the image then fire the desired event.

    Mouse position using jQuery outside of events will show you how to keep track of the mouse position. Then just find the offset of the image and see if it's inside the image.

提交回复
热议问题