HTML代码:
css代码:
Box-sizing:border-Box; display: inline-block;}
.point li.active{background: #fff;}
.btn{ position: relative;}
.btn span{ display: inline-block; vertical-align: top; width: 100px; height: 100px; background: rgba(0,.5); position: absolute; top:-235px; cursor: pointer;}
.btn .prev{left: 0}
.btn .next{ right: 0;}
js代码:
上一页,e是下一页
index=0;
len=$(a).length-1;
function teb(index){
$(c).eq(index).addClass(b).siblings('').removeClass(b);
$(a).eq(index).fadeIn(300).addClass('curr').siblings('').fadeOut(300).removeClass('curr');
};
$(c).click(function(){
index=$(this).index();
teb(index);
});
$(d).click(function(){
index--;
if(index<0){
index=len;
};
teb(index);
});
$(e).click(function(){
index++;
if(index>len){
index=0;
};
teb(index);
});
function timeRun(){
time=setInterval(function(){
index++;
if(index>len){
index=0;
};
teb(index);
},3000);
};
timeRun();
};
banner('.back>li','active','.point>li','.prev','.next');
});