Confused here. What's the best way to change the hover CSS of the link below, and how? toggle.Class? add.Class? I want to show an image on hover. I have been able to change the color of the text with
$("#menu-item-1099 a:contains('rss')").css("color", "#5d5d5d");
but can't seem to target the hover class.
<div id="access">
<div class="menu-header">
<ul id="menu-main-menu" class="menu">
<li id="menu-item-1099" class="menu-item menu-item-type-custom menu-item-1099">
<a href="http://mydomain.com/feed/">rss</a></li>
When you use
.css()
in jQuery, you're not actually changing the CSS file / creating new CSS rules. You're simply adding CSS to specific elements'style
attribute (inline CSS).So, you can't "target the hover class" - you have to do something on hover in, and revert that on hover out:
it is simple way to make it. when mouseover you can show your image, whne mouseout you can remove your image
You can use .hover on the element, like this
if you want to use .toggle()
you only need to create a class on your style sheet, make the background the image you want, and put it here