Monday, 12 August 2013

setInterval not working properly with chrome

setInterval not working properly with chrome

I've made an image fader using 2 <div>s (one is an image and the other is
a ul containing several images) the script is working perfectly on firefox
and Safari but not working properly on Chrome, it just does the first fade
and then it stops the script is this
$("#second").css({
opacity: 0.0
});
$(function () {
setInterval("rotateImages()", 4000);
});
function rotateImages() {
if ($("#first").css("opacity") == 1) {
$("#first").animate({
opacity: 0.0
}, 1500);
$("#second").animate({
opacity: 1.0
}, 1500);
} else {
$("#second").animate({
opacity: 0.0
}, 1500);
$("#first").animate({
opacity: 1.0
}, 1500);
};
};
I don't know where exactly the problem is and how to make the script work
on all browsers. any help would be much appreciated
Thanks

No comments:

Post a Comment