十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
html代码:

成都创新互联公司专注于抚远企业网站建设,响应式网站开发,成都做商城网站。抚远网站建设公司,为抚远等地区提供建站服务。全流程按需网站建设,专业设计,全程项目跟踪,成都创新互联公司专业和态度为您提供的服务
轮播图练习
css代码:
*{margin:0; padding: 0;}
ul li{list-style: none;}
.back{height: 400px; overflow: hidden; margin-top:100px;}
.back li{width: 100%; height: 400px; margin:0 auto;}
.back li.l1{background: red;}
.back li.l2{background: yellow;}
.back li.l3{background: blue;}
.back li.l4{background: black;}
.back li.l5{background: green;}
.point{text-align: center; margin-top: -30px;}
.point li{ width: 20px; height: 20px; border:2px solid #fff; border-radius: 10px; 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,0,0,.5); position: absolute; top:-235px; cursor: pointer;}
.btn .prev{left: 0}
.btn .next{ right: 0;}
js代码:
$(function(){
function banner(a,b,c,d,e){ // a是背景图,b是active,c是背景对应按钮,d是上一页,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');
});
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持创新互联!