0

我正在尝试在动画开启时使用 step 函数更改 jQuery 动画的持续时间,例如缓动效果。我创建了一个示例来检查它,这里是 jsFiddle

$('span').click(function() {
   var _this = $(this);
   if( !_this.is(':animated') ) {

       var target = 400;
       var speed = 1000;

        _this.animate({'top': target +'px'},{
            duration: speed,
            step: function(now,fx) {
                //what does fx stands for anyway, i cound'nt solve it?

                if ( now >= 300 ) { speed=100; }
                //condition works but it won't effect the current animation
            }
        });

    }
});
4

0 回答 0