I have defined an <a>
tag with css. I'm trying to stop default stylesheet :hover
changes on the a
tag. How do I disable the hover changes on the a tag in Jquery?
Is hover deprecated in jQuery? Deprecated in jQuery 1.8, removed in 1.9: The name “hover” used as a shorthand for the string “mouseenter mouseleave” .
The hover() is an inbuilt method in jQuery which is used to specify two functions to start when mouse pointer move over the selected element. Syntax: $(selector). hover(Function_in, Function_out);
jQuery hover() MethodThe hover() method specifies two functions to run when the mouse pointer hovers over the selected elements. This method triggers both the mouseenter and mouseleave events. Note: If only one function is specified, it will be run for both the mouseenter and mouseleave events.
Live demo of the following solution: http://jsbin.com/umiru
--
The easiest way I can think of is to change:
a:hover { ... }
into
a.someClass:hover { ... }
And then add/remove .someClass
via jQuery's methods:
$(this).addClass("someClass"); // activates css rules for :hover
$(this).removeClass("someClass"); // deactivates css rules for :hover
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With