jQuery image fader slow in IE6 & 7

Posted by Jamie on Stack Overflow See other posts from Stack Overflow or by Jamie
Published on 2010-04-14T15:02:35Z Indexed on 2010/04/14 15:03 UTC
Read the original article Hit count: 258

Filed under:

Hi guys, I'm using the following jQuery script to rotate through a series of images pulled into an unordered list using PHP:

function theRotator() {
    $('#rotator li').css({opacity: 0.0});
    $('#rotator li:first').css({opacity: 1.0});
    setInterval('rotate()',5000);
};

function rotate() { 
    var current = ($('#rotator li.show') ?  $('#rotator li.show') : $('#rotator li:first'));
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('#rotator li:first') :current.next()) : $('#rotator li:first'));   
    next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 2000);
    current.animate({opacity: 0.0}, 2000).removeClass('show');
};

$(document).ready(function() {      
    theRotator();
});

It works brilliantly in FF, Safari, Chrome and even IE8 but IE6 & 7 are really slow. Can anyone make any suggestions on making it more efficient or just work better in IE6 & 7?

The script is from here btw. Thanks.

© Stack Overflow or respective owner

Related posts about jQuery