Ad rotator not working
Ad rotator not working
A previous web developer provided this ad rotator script for our site.
- var image_count;
var current_image=0;
var image_count_left;
var current_image_left=0;
$(document).ready(function(){
image_count = $("#banner div").hide().size();
image_count_left = $("#banner2 div").hide().size();
$("#banner div:eq("+current_image+")").show();
setInterval(feature_rotate,13000); //time in milliseconds
$("#banner2 div:eq("+current_image_left+")").show();
setInterval(feature_rotate2,10000); //time in milliseconds
});
function feature_rotate() {
var old_image = current_image%image_count;
var new_image = ++current_image%image_count;
$("#banner div:eq(" + old_image + ")").fadeOut(1, function() {
$("#banner div:eq(" + new_image + ")").fadeIn("slow");
});
}
function feature_rotate2() {
var old_image = current_image_left%image_count_left;
var new_image = ++current_image_left%image_count_left;
$("#banner2 div:eq(" + old_image + ")").fadeOut("slow", function() {
$("#banner2 div:eq(" + new_image + ")").fadeIn("slow");
});
}
Now, the HTML it is supposed to rotate looks like this:
- <div id="banner">
<div id="look_image0">
<object width="715" height="90">
<param name="movie" value="file_uploads/banners/banner.swf">
<embed src="file_uploads/banners/banner.swf" width="715" height="90"></embed>
</object>
</div> <!-- look_image -->
<div id="look_image1">
<object width="715" height="90">
<param name="movie" value="file_uploads/banners/crimp.swf">
<embed src="file_uploads/banners/crimp.swf" width="715" height="90"></embed>
</object>
</div> <!-- look_image -->
</div> <!-- banner -->
We have multiple flash animations that must be rotated. Now, if you open the page, the flash animations are on top of each other and they "bleed" through each other.
Me thinks that since the divs that contain the ads have ids look_image1 and look_image2 that the rotation code isn't going to work at all. Why doesn't the banner rotation code work and what needs to be changed to make it work?