I don't know why, but the animate() in the hover "out" function seems to start from the 0
value, instead of 16
which should be set by the hover "in" function:
$.fx.step.textShadowBlur = function(fx) {
$(fx.elem).css({textShadow: '0 0 ' + Math.floor(fx.now) + 'px #000'});
};
$('a').hover(function(){
$(this).stop().animate({textShadowBlur:16}, {duration: 400});
}, function(){
$(this).stop().animate({textShadowBlur:0}, {duration: 900});
});
So I get a abrupt text shadow change on mouse out, no animation
What am I doing wrong?
ok, I fixed it. It seems to be jquery bug with the step function definition or something. ANyway this will work:
$('a').hover(function(){
$(this).stop().animate({nothing:16}, {duration: 400, step: function(now, fx){
$(this).css({textShadow: '0 0 ' + Math.floor(fx.now) + 'px #000'});
}});
}, function(){
$(this).stop().animate({nothing:0}, {duration: 900, step: function(now, fx){
$(this).css({textShadow: '0 0 ' + Math.floor(fx.now) + 'px #000'});
}});
});