When using setInterval, if I switch tabs in Chrome and go back, the slider goes crazy catching up

前端 未结 6 687
醉话见心
醉话见心 2020-11-28 05:05

I have a jQuery slider on my site and the code going to the next slide is in a function called nextImage. I used setInterval to run my function on a timer, and it does exact

6条回答
  •  攒了一身酷
    2020-11-28 05:22

    If you are using Soh Tanaka's image slider then just add this...to solve your Google Chrome issue:

    $(".image_reel").stop(true, true).fadeOut(300).animate({ left: -image_reelPosition}, 500 ).fadeIn(300);

    Take note of the .stop() function. Ignore the fading in and out stuff, that's what I used on my version

    Thanks

提交回复
热议问题