简体   繁体   中英

jquery animation moving and stopping

I got a div with an image inside it using query

                $('#super').animate({
                left:'150px'
                }, {
                duration: 10000,});

What iam trying to figure out is how to stop and start animation. So for example it will start to move left 150px and then will stop for 2 seconds and then move left 300px.

Like this:

$('#super').animate({left : '-=150'}).delay(2000).animate({left : '-=300'});

Demo: http://jsfiddle.net/E7akr/

(You can add duration, easing and complete settings to the .animate() calls as desired - obviously the key thing here is the .delay() method .)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM