【发布时间】:2012-02-07 13:01:44
【问题描述】:
我正在制作一个滑块,但我的缩略图出现了一些问题,它们的动画速度比主图像的渐变快,(经过几次拇指动画后,它们与主幻灯片的动画不同步......他们需要在同一时刻)他们有相同的速度,所以我不明白为什么会产生这个错误......
jQuery(document).ready(function(){
speed = 8000;
max_slide = jQuery(".slides_control div.fps-slide").size();
val_x = 0;
run = setInterval('rotate()', speed);
jQuery("#slider").hover(
function () { clearInterval(run); },
function () { run = setInterval('rotate()', speed); }
);
});
function rotate() {
thumbFirst = jQuery(".fps-pagination li:first-child");
thumbContainer = jQuery(".fps-pagination");
animationSpeed = 800;
if (val_x > max_slide) { val_x = 0 }
thumbFirst.clone().appendTo(jQuery(".fps-pagination"));
jQuery(".slides_control div.fps-slide:eq("+val_x+")").animate({"opacity":"0"}, { queue: false, duration: animationSpeed });
val_x++;
jQuery(".slides_control div.fps-slide:eq("+val_x+")").animate({"opacity":"1"}, { queue: false, duration: animationSpeed });
thumbContainer.animate(
{"top":"-137px"},
{queue:false, duration: animationSpeed,
complete: function() {
thumbFirst.remove();
thumbContainer.css({"top": "0px"})
}
});
}
jsFiddle : http://jsfiddle.net/AY3y2/1/ (在这个环境中不能很好地工作) 直播代码:http://webserver.lewebsimple.ca/~tempcode/
【问题讨论】:
标签: jquery slider jquery-animate