How can I overwrite the CSS below with jQuery?
(The animations aren’t being run and it’s just an instantaneous switch.)
menu span ul {display: none;}
menu span:hover ul {display: block;}
$('#menu span').mouseenter(function(){
$('#menu span ul').slideDown('fast');
}).mouseleave(function(){
$('#menu span ul').slideUp('fast');
});
One trick for graceful degredation is to not have to override the styles, like this:
Of have a linked stylesheet the same way with all of these for-non-JS-user styles.
Or, do it via a class you apply to
#menuthat you can remove so the rules no longer match, like this:And in your script just remove that class:
As a side note, you can slim down your code using
.hover()and.slideToggle()like this: