I do not know why, but the animate () function in the "out" function is induced starting from the value 0 , not 16 , which must be set by the "in" function: / p>
$.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 sharp change in the shadow of the text on the mouse, without animation
What am I doing wrong?
ok, I fixed it. This seems to be a jquery error with defining a step function or something else. In any case, 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'}); }}); });
source share