jquery - hover() backgroundColor problem -
$('li > a').hover( function(){ $(this).animate({ backgroundcolor: '#2a639a', color: '#fff' },300).corner('5px'); }, function(){ $(this).animate({ background: 'transparent', color: '#444' },300); } );
what's wrong background: 'transparent'? turns white, not transparent
important thing note: transparent in css different 0% opacity.
opacity can graduated, whereas tranparent either on or off. therefore cannot animate transparent or solid colour , expect smooth transition. if try, browsers treat either black or white purposes animation, think you're seeing here.
animating opacity instead may give smoother transition, though of course different (for starters affects whole element, not background, plus there browser compatibility issues consider).
Comments
Post a Comment