/ Published in: JavaScript

Found this quick little bit of code on the Google jQuery discussion group. It simply fades the background image of a link you have hovered over to a certain color, then fades it back to the original color.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Grab the original BG color of the link var originalBG = $(".animate").css("background-color"); //The color you want to fade too var fadeColor = "#CCCCCC"; //Now animate on links with class = animate $(".animate").hover( function() { $(this) //Fade to the new color .animate({backgroundColor:fadeColor}, 750) //Fade back to original color .animate({backgroundColor:originalBG},750) }, function(){ } );
Comments
