我正在尝试为我的网站使用jQuery制作一个图像循环播放器,但是我无法通过它循环播放。我想添加三个按钮,它们将循环播放图片,button1 =第一张图片,button2 =第二张图片等...并让它每5秒左右自动循环一次,如果按钮没有被点击,我会如何做到这一点。我寻找解决方案,没有运气。帮助将不胜感激。 我的代码是:Jquery Image Cycler
$(document).ready(function() {
var current = 1
if(current == 1){
$('.imgslide1').fadeOut();
$('.imgslide2').fadeOut();
$('.imgslide3').fadeOut();
$('.imgslide1').fadeIn().delay(3000).fadeOut().curr();
};
if(current == 2){
$('.imgslide1').fadeOut();
$('.imgslide2').fadeOut();
$('.imgslide3').fadeOut();
$('.imgslide2').fadeIn().delay(3000).fadeOut().curr();
};
if(current == 3){
$('.imgslide1').fadeOut();
$('.imgslide2').fadeOut();
$('.imgslide3').fadeOut();
$('.imgslide3').fadeIn().delay(3000).fadeOut().curr();
};
if(current > 3){
current = 1;
};
function curr(){
current++;
};
$('#button1').click(function() {
current = 1
});
$('#button2').click(function() {
current = 2
});
$('#button3').click(function() {
current = 3
});
});
jQuery循环插件 – jacktheripper 2012-08-09 22:21:45