0
votes

I've got a function using the setInterval() to loop through several pictures. It works fine in Firefox and IE (if it is on my computer). If I upload it on the internet though IE doesn't ask if I would like to allow ActiveX controls (instead I get a "default browser" pop-up) and they remain disabled, leaving my setInterval not working. The function is executed correctly onClick, but not with setInterval

   setInterval(function(){
if (status == "on" ){

$('#NavigationSites li').removeClass('active');
    $('#NavigationSites li:eq('+ x +')').addClass('active');
    $('#TechnologiesWork').html('<img src = "img/'+x+'BackgroundTech.png"/> ');
    $('#PicSiteArena').hide().html('<a href = "#"><img src =      "img/'+x+'Arena.png"/></a> ').fadeIn('slow');
    x++;
    if ( x == "5"){
    x = "0";
}//status on
    }
}, 5000);
1

1 Answers

0
votes

Strangely, the problem was found to be in the IF block (found that due experimentation). If you use a variable with a boolean value (true and false) it works in IE on the internet too.

setInterval(function(){
        if ( on ){
        $('#NavigationSites li').removeClass('active');
        $('#NavigationSites li:eq('+ x +')').addClass('active');
        $('#TechnologiesWork').html('<img src = "img/'+x+'BackgroundTech.png"/> ');
        $('#PicSiteArena').hide().html('<a href = "#"><img src = "img/'+x+'Arena.png"/></a> ').fadeIn('slow');
        x++;
            if ( x == "5"){
                x = "0";
            }
        }
        }, 5000);


$('#LastSitesArena').mouseenter(function(){
on = !on;
});
$('#LastSitesArena').mouseleave(function(){
on = true;
});