• # June 27, 2013 at 8:18 am

    Hi, guys

    Here is my script , there is setInterval and I want to clearInterval after you click on a button. Everything works if setInterval 500-1000ms, but when I change it on 200 buttonv continues jumps. I read somewhere that setInterval can be rewrite to setTimeout and I wondering if it can fix my problem? Thnaks for reply

    # June 27, 2013 at 9:02 am

    This reply has been reported for inappropriate content.

    It’s because your interval is faster than the animation, so they queue up. Even if you clear the interval, jQuery will keep playing queued up animations until they are all finished.

    Make sure the interval time is at least the total animation time, and check this how to clear the queue:

    # June 27, 2013 at 9:10 am

    clear the interval and after that add


    Edit : @CrocoDillon beat me to it.

    # June 27, 2013 at 10:38 am

    Thanks @CrocoDillon, @pixelgrid fixed with $button.stop(true, true);

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.