Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Issue with setInterval and setTimeout

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45866
    Kuzyo
    Participant

    Hi, guys

    Here is my script http://codepen.io/Kuzyo/pen/dEtnp , 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

    #140698
    pixelgrid
    Participant

    clear the interval and after that add

    $button.stop();

    Edit : @CrocoDillon beat me to it.

    #140712
    Kuzyo
    Participant

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.