Trying to get a fallback for CSS3 transitions using jQuery [duplicate]
-
07-07-2021 - |
Question
Possible Duplicate:
Special color transition effect with pure jQuery animation // no ui or other libary
I think this code should be it, but it's not working. I can tell it's changing the colors, but it's not fading (like CSS3 transitions). Please help. My code:
$(document).ready(function(){
$("#nav-wrap ul li a").mouseover(function(){
$(this).css("color","#444");
});
$("#nav-wrap ul li a").mouseout(function(){
$(this).css("color","#999");
});
});
Solution
$(document).ready(function(){
$("#nav-wrap ul li a").hover(function(){
$(this).stop().animate({color:'#444'}, 300);
}, function () {
$(this).stop().animate({color:'#999'}, 100);
}
)}
});
This code require jQuery UI.
OTHER TIPS
What you need is to animate()
the element, not simply to change the color value in css. Here is a reference on how to do it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow