CSS :hover Pseudo Class

10:07 AM by Markus Bäck

Filed under Css Hacks

Last modified Tuesday September 29th, 2009


IE only supports :hover pseudo class for anchor elements. You can fix this issue with jQuery’s hover event.

jQuery

$('ul li').hover(

function () {
$(this).addClass('element');
},

function() {
$(this).removeClass('element');
}
);

CSS

.element {
background-color:red;
}

UL List

<ul>
   <li><a href="#" title="Home">Home</a></li>
   <li><a href="#" title="About">About</a></li>
   <li><a href="#" title="Portfolio">Portfolio</a></li>
   <li><a href="#" title="Contact">Contact</a></li>
</ul>

 

Related Articles

                                                          Leave a Comment