setInterval jumps when move between browser tabs

> **Possible Duplicate:** > [How can I make setInterval also work when a tab is inactive in Chrome?](https://stackoverflow.com/questions/5927284/how-can-i-make-setinterval-also-work-when-a-tab-is-inactive-in-chrome) http://www.datingjapan.co I have setInterval changing images as follows: var initialFadeIn = 1000; //initial fade-in time (in milliseconds) var itemInterval = 6000; //interval between items (in milliseconds) var fadeTime = 2500; //cross-fade time (in milliseconds) var infiniteLoop = setInterval(function(){ position1.eq(currentItem1).fadeOut(fadeTime); if(currentItem1 == numberOfItems1 -1) {currentItem1 = 0;}else{currentItem1++;} position1.eq(currentItem1).fadeIn(fadeTime); }, itemInterval); I notice when I move between browser tabs in Chrome that when I come back to the site (after the interval has passed) the images quickly jump to the next. Is it possible to make this smoother? or make this occur in the background? any info on this would be great. thx
This was answered in: stackoverflow.com/questions/5927284/… I'm not sure how to link to a specific post, but search for the one with the link: jsfiddle.net/7f6DX/31 You can also just go to that link for a proposed method that works.

以上就是setInterval jumps when move between browser tabs的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏