PDA

View Full Version : Need to slow this rotator down



javanewbie7
01-27-2011, 04:07 PM
I'm trying to slow this image rotator down.


I thought I would just change the setInterval part. But it's not working.


$(function() {
setInterval( "nextPage()", 7000 );
});

Below is the full script. Am I missing something?


// Global variable that controls billboard image rotation
var $rotate = 1;

// Load this script when page loads
$(document).ready(function(){

// Set up a listener so that when anything with a class of 'bbtab'
// is clicked, this function is run.
$('.bbtab').click(function () {

// Turn off autorotation.
$rotate = 0;

// Remove the 'bboard_page_active' class from the visible tab contents.
$('#bboard > ul > li.bboard_page_active').removeClass('bboard_page_active');

// Add the 'bboard_page_active' class to the associated tab contents.
$(this.rel).addClass('bboard_page_active');
return false; //stop the links default action
});
});

function nextPage() {
// id is expected to look like 'bbpage1'.
// We just need the number part at the end so that we can figure out which page is next in the rotation.
var $active_page = $('#bboard > ul > li.bboard_page_active').attr('id') || 'bbpage0';
var $next_page = parseInt($active_page.substring(6)) + 1;
if ($next_page > $('#bboard > ul > li').length) { $next_page = 1; }
if ($rotate == 1) {
// Remove the 'bboard_page_active' class from the active page.
$('#'+$active_page).removeClass('bboard_page_active');
// Add the 'bboard_page_active' class to the next page.
$('#bbpage'+$next_page).addClass('bboard_page_active');
// alert("Active page is " + $active_page + " of " + $total_pages + " and next is " + $next_page);
}
}

$(function() {
setInterval( "nextPage()", 7000 );
});