Hi all,
I am animating the bg color of some links. But I have changed the bg color of each link, so they have unique bg colors.
When I use the jq function i normally use, It doesnt work properly because I can only animate back to one specific color, which i had declared in the callback function..
So..I am asking: How do I save the background color of the element on hover, animate it, and change it back to the color saved in the variable:
$(document).ready(function(){
$("#main_nav ul li a").hover(function() {
// Doesnt this save the original color of the element being hovered?
var original_color = $(this).css('backgroundColor');
$(this).animate({ backgroundColor: "#069" }, 800);
},function() {
// How do I use the variable with the original color in here? - This doesnt work..
$(this).animate({ backgroundColor: original_color }, 300);
});
});
Klemme