I've got a small piece of code that isn't working, take a look:
$(document).ready(function() {
$('ul#mainmenu li:hover').css({backgroundColor:''});
$('ul#mainmenu li').hover(function() {
$(this).animate({backgroundColor:'#2E8AE5'}, slow);
});
});
It's meant to:
1) unset the CSS property background-color
from a list item with the pseudo-class :hover
in the unordered list with an id of mainmenu (this is so those without Javascript enabled can still experience a similar effect to what I'm trying to achieve with jQuery)
2) When the same list item is then hovered over, it should animate in the background-color on said list item.
But it doesn't. Instead, the first task isn't even completed, let alone animating in the background on hover. It's worth noting that I have triple checked my elements (I even copied them and pasted them into the script to make sure).
And I am using jQuery UI - which I understand can perform such tasks involving animating certain CSS properties. Ideas?