理由はわかりませんが、ホバー「アウト」関数の animate() は、ホバー「イン」関数で設定するのでは0
なく、値から開始するようです。16
$.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});
});
そのため、マウスアウト時にテキストの影が突然変化し、アニメーションは表示されません
私は何を間違っていますか?
jsfiddle
わかりました、私はそれを修正しました。ステップ関数の定義か何かでjqueryのバグのようです。とにかくこれはうまくいきます:
$('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'});
}});
});