Stop ":hover" elements from holding their state when animated away from cursor with jQuery?

christian

I'm having an issue where elements do not lose their :hover when the element is animated away from the mouse via jQuery animate().

The :hover stays applied until the mouse is moved. Is there any way to stop this behavior?
It seems to happen in IE, Chrome, and Firefox.

a better oliver

There is a way to remove the hover state, but it may not work on all browsers and has its drawbacks.

The secret weapon is the CSS property pointer-events. If you set it's value to none, then the element no longer receives mouse events. If it's in a hovered state it loses that state (tested in Chrome and Safari).

Removal of the hover state only works while the mouse pointer is still over the element. So if you do that before the animation starts you will see either no hover state at all or a short flash, depending on the browser.

If that's a problem for you, you need to calculate a timeout or use a progress handler for .animate() to get the right moment.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Stop ":hover" elements from holding their state when animated away from cursor with jQuery?

From Dev

How to stop http request or stop handling http request result, when moving away from state?

From Dev

Stop cursor from changing on a cursor div when the user scrolling the document jquery

From Dev

Stop Matlab from resizing the surface when creating an animated gif

From Dev

Stop Hover Effect from Moving Other Elements Down on Page

From Dev

Hover state on animated element

From Dev

balls moving away from cursor project in processing

From Dev

jQuery file not found when navigating away from home page

From Dev

How to stop Main Menu from extending when it cursor is hovered

From Dev

Close div only when cursor is further away then 200px from the div

From Dev

How to stop cursor from blinking

From Dev

How do I remove the :hover state from a link using jquery?

From Dev

JQuery. Moving between two elements (one animated) on hover?

From Dev

How to stop an animated gif from looping

From Dev

How to stop my div from opening and closing right away on body click jQuery?

From Dev

jQuery Hover with Delay when the user moves their mouse away

From Dev

From a CSS perspective, what state is an input button in when you click, hold down for a second and then drag away?

From Dev

How to save the state of css background-color property change when navigating away from one menu to another

From Dev

How to save the state of css background-color property change when navigating away from one menu to another

From Dev

Holding any key and then pressing shift will stop the key from repeating

From Dev

How to set the cursor some spaces away from the start in an EditText in Android?

From Dev

Exclude pseudo elements from hover

From Dev

jQuery: Show div to the right of cursor on hover of some elements

From Dev

HTML, stop elements on page from moving when browser is resized

From Dev

jQuery - Hide jQdialog on keypress away from .datepicker

From Dev

Perform action when navigating away from a page

From Dev

How to stop CodeMirror from moving cursor on keyup?

From Dev

Ionic - Pause/Stop Video on Navigating away from a view

From Dev

Stop a function from running on hover of element

Related Related

  1. 1

    Stop ":hover" elements from holding their state when animated away from cursor with jQuery?

  2. 2

    How to stop http request or stop handling http request result, when moving away from state?

  3. 3

    Stop cursor from changing on a cursor div when the user scrolling the document jquery

  4. 4

    Stop Matlab from resizing the surface when creating an animated gif

  5. 5

    Stop Hover Effect from Moving Other Elements Down on Page

  6. 6

    Hover state on animated element

  7. 7

    balls moving away from cursor project in processing

  8. 8

    jQuery file not found when navigating away from home page

  9. 9

    How to stop Main Menu from extending when it cursor is hovered

  10. 10

    Close div only when cursor is further away then 200px from the div

  11. 11

    How to stop cursor from blinking

  12. 12

    How do I remove the :hover state from a link using jquery?

  13. 13

    JQuery. Moving between two elements (one animated) on hover?

  14. 14

    How to stop an animated gif from looping

  15. 15

    How to stop my div from opening and closing right away on body click jQuery?

  16. 16

    jQuery Hover with Delay when the user moves their mouse away

  17. 17

    From a CSS perspective, what state is an input button in when you click, hold down for a second and then drag away?

  18. 18

    How to save the state of css background-color property change when navigating away from one menu to another

  19. 19

    How to save the state of css background-color property change when navigating away from one menu to another

  20. 20

    Holding any key and then pressing shift will stop the key from repeating

  21. 21

    How to set the cursor some spaces away from the start in an EditText in Android?

  22. 22

    Exclude pseudo elements from hover

  23. 23

    jQuery: Show div to the right of cursor on hover of some elements

  24. 24

    HTML, stop elements on page from moving when browser is resized

  25. 25

    jQuery - Hide jQdialog on keypress away from .datepicker

  26. 26

    Perform action when navigating away from a page

  27. 27

    How to stop CodeMirror from moving cursor on keyup?

  28. 28

    Ionic - Pause/Stop Video on Navigating away from a view

  29. 29

    Stop a function from running on hover of element

HotTag

Archive