Andrea
Andrea

Reputation: 477

IE8 jquery animate issue

In IE8 the animation only runs once and stops. It needs to be an infinite loop. Works everywhere else except for IE8 (go figure...!) Know of any work around to make this infinite in IE8? Here's the code:

    <script type="text/javascript">
    $(document).ready(function(){

    setInterval(function() {
    $("#hand").animate({left: '-=300px'}, 490).animate({left: '+=300px'}, 550).delay(5200) ;}, 5200);
    });
    </script>

Many Thanks, Andrea

Upvotes: 0

Views: 679

Answers (1)

ShankarSangoli
ShankarSangoli

Reputation: 69915

There is no need to specify the delay because setInterval itself will run after every 5200 ms. Try this.

setInterval(function() {
    $("#hand")
    .animate({left: '-=300px'}, 490)
    .animate({left: '+=300px'}, 550);
}, 5200);

Upvotes: 1

Related Questions