- This topic is empty.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Autoplaying Featured Slider initial duration issue
I’ve successfully implemented the Autoplaying Featured Content Slider on a site but seem to be running into a timing issue when the page load. My client wanted me to set the duration between each slide to 6 seconds which I have done correctly (see configuration below). The problem is it takes approx 12 seconds for the first slide to rotate. I’ve toyed with the duration (lowering it to 3 seconds) which makes the initial slide take about 6 seconds to scroll. It seems that whatever duration I set, it doubles it for the initial scroll. Here’s my code:
var theInt = null;
var $crosslink, $navthumb;
var curclicked = 0;
theInterval = function(cur){
clearInterval(theInt);
if( typeof cur != 'undefined' )
curclicked = cur;
$crosslink.removeClass("active-thumb");
$navthumb.eq(curclicked).parent().addClass("active-thumb");
$(".stripNav ul li a").eq(curclicked).trigger('click');
theInt = setInterval(function(){
$crosslink.removeClass("active-thumb");
$navthumb.eq(curclicked).parent().addClass("active-thumb");
$(".stripNav ul li a").eq(curclicked).trigger('click');
curclicked++;
if( 3 == curclicked )
curclicked = 0;
}, 6000);
};
$(function(){
$("#main-photo-slider").codaSlider();
$navthumb = $(".nav-thumb");
$crosslink = $(".cross-link");
$navthumb
.click(function() {
var $this = $(this);
theInterval($this.parent().attr('href').slice(1) - 1);
return false;
});
theInterval();
});
And you can view the site at http://www.firstelemententertainment.com/
Any suggestions?