我有一个用 jQuery 构建的图像滑块。它设置为以 7000 毫秒的间隔滑动图像。有时,并且仅有时,滑块似乎会以超高速(幻灯片之间大约 1 秒的间隔)滑动图像。我无法确定原因。请帮忙!
使用滑块链接到网站:http ://healthyhometech.com
function slider() {
$(".paging").hide();
$(".paging a:first").addClass("active");
var imageWidth = $(".window").width();
var imageSum = $(".image_reel img").size();
var imageReelWidth = imageWidth * imageSum;
$(".image_reel").css({'width' : imageReelWidth});
rotate = function(){
var triggerID = $active.attr("rel") - 1;
var image_reelPosition = triggerID * imageWidth;
$(".paging a").removeClass('active');
$active.addClass('active');
$(".image_reel").animate({
left: -image_reelPosition
}, 500 );
};
rotateSwitch = function(){
play = setInterval(function(){
$active = $('.paging a.active').next();
if ( $active.length === 0) {
$active = $('.paging a:first');
}
rotate();
}, 7000); //Timer speed
};
rotateSwitch();
$(".image_reel a").hover(function() {
clearInterval(play);
}, function() {
rotateSwitch();
});
};