开发者

make jquery animation faster

开发者 https://www.devze.com 2022-12-31 19:08 出处:网络
while loading a page i am using a animation, wid=j开发者_StackOverflowQuery(window).width()+400; jQuery(\'#div\').animate({\'marginLeft\' : \'+=\'+wid+\'px\'},{queue:false, duration:20000 })

while loading a page i am using a animation,

wid=j开发者_StackOverflowQuery(window).width()+400;
jQuery('#div').animate({'marginLeft' : '+='+wid+'px'},{queue:false, duration:20000 })

div, is being moved to left in 20 sec.

I use this animation for loading page. when page is loaded <body onload=myfunction()> is called. when myfunction is called (page is loadad completly) i want to my animation faster.

how to change an animation duration while it's animating?


You're probably best off interrupting the animation and queuing up a new one with the desired duration.

$('#div').stop(true, false).animate(...);
0

精彩评论

暂无评论...
验证码 换一张
取 消