【发布时间】:2014-06-15 02:06:10
【问题描述】:
我正在用 jquery 制作滑块。
var slidePath = '.testSlider > div.slide';
var sliderDuration = 53000;
var rotate = setInterval(slideShow, sliderDuration);
$(slidePath).hide();
slideShowFirst();
$('.slider-block').hover(function() {
clearInterval(rotate);
}, function() {
rotate = setInterval(function() {
slideShow();
}, sliderDuration);
});
$('.control-right').click(slideShow);
$('.control-left').click(function() {
$(slidePath + ':eq(-2)').fadeIn('slow');
$(slidePath + ':last-child').fadeOut('slow').prependTo('.testSlider');
});
function slideShow() {
$(slidePath + ':last-child').fadeOut('slow');
$(slidePath + ':first-child').fadeIn('slow').appendTo('.testSlider');
}
function slideShowFirst() {
$(slidePath + ':first-child').appendTo('.testSlider').show();
}
在我的滑块中有简单的 Ken Burns 效果。使用 css 动画,当前幻灯片图像正在旋转和放大。
当我转到 PREVIOUS 幻灯片时,当前图像在一秒钟内恢复到其原始状态(比例为 100%,无缩放),然后出现上一张幻灯片。它看起来很丑。当我转到下一张幻灯片时,我没有这样的问题。
怎么了?
我试图改变它的左控制功能:
$('.control-left').click(function() {
$(slidePath + ':last-child').fadeOut('slow');
$(slidePath + ':eq(-2)').fadeIn('slow');
$(slidePath + ':last-child').prependTo('.reveSlider');
});
但我没有任何变化..
【问题讨论】: