图片轮播与点击事件

图片轮播与点击事件结合起来,挺麻烦的,应该还有更简单的方法,但这比之前写的好多了

c=1;
x=1;
prev.click(function(){
if(c!=3){
da1.stop();
da1.animate({marginLeft:c*(-1100)+"px"},
500,
function(){
c++;
})
}
})
next.click(function(){
if(c!=1){
da1.stop();
da1.animate({marginLeft:(c-2)*(-1100)+"px"},
500,
function(){
c--;
})
}
})
c3.click(function(){
prev.click(function(){
if(x!=2){
da3.stop();
da3.animate({marginLeft:x*(-1100)+"px"},
500,
function(){
x++;
})
}
})
})
c3.click(function(){
next.click(function(){
if(x!=1){
da3.stop();
da3.animate({marginLeft:(x-2)*(-1100)+"px"},
500,
function(){
x--;
})
}
})
})

原文地址:https://www.cnblogs.com/m110/p/7683605.html