Forums

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

Home Forums Back End PHP Slide Show Bug Re: PHP Slide Show Bug

#123840
CrocoDillon
Participant

First issue is a JavaScript issue. I think the `setInterval()` function calls build up when tabbed. You can try changing:

$(function() {
setInterval( “slideSwitch()”, 5000 );
});

into

$(function() {
var id = setInterval(slideSwitch, 5000);
$(window).blur(function(){
clearInterval(id);
});
$(window).focus(function(){
id = setInterval(slideSwitch, 5000);
});
});

to cancel the interval when the window loses focus and resume when it gains focus. (I haven’t tested this but it could work)