Tuesday, 20 August 2013

backgroundColor does not animate, but width does in jQuery

backgroundColor does not animate, but width does in jQuery

I want the color of my div.navBtn elements to change through an animation
effect. It isn't working out and I don't know why.
$(document).ready(function()
{
$("button").click(function()
{
$("div.navBtn").animate(
{
width:'+=10px',
backgroundColor: "#aa0000"
});
});
});
backgroundColor is what does the actual color changing but it does not
work. Width +=10 works perfectly, backgroundColor does absolutely nothing.
Is the syntax wrong or something??? I copied "backgroundColor: "#aa0000""
from another help posting here. Does anyone know what the problem is?

No comments:

Post a Comment