如何在动画开启时使用步进功能操纵动画的持续时间?

时间:2013-01-30 17:30:08

标签: javascript jquery css jquery-animate

我正在尝试在动画启动时使用步进功能更改jQuery动画的持续时间,例如缓动效果。我创建了一个检查它的示例here is 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
            }
        });

    }
});

0 个答案:

没有答案