html 淡出淡入轮播图,淡入淡出轮播图

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

http://www.w3.org/1999/xhtml">

图片轮播 jq(淡入淡出)

body,div,ul,li,a,img{margin: 0;padding: 0;}

ul,li{list-style: none;}

a{text-decoration: none;}

.wrapper{position: relative;margin: 30px auto;width: 400px;height: 200px;}

.banner{width: 400px;height: 200px;overflow: hidden;}

.imgList{width:400px;height:200px;z-index: 10;}

.imgList li{display: none;}

.imgList .imgOn{display: inline;}

.bg{position: absolute;bottom: 0;width: 400px;height: 40px;z-index:20;opacity: 0.4;filter:alpha(opacity=40);background: black;}

.infoList{position: absolute;left: 10px;bottom: 10px;z-index: 30;}

.infoList li{display: none;}

.infoList .infoOn{display: inline;color: white;}

.indexList{position: absolute;right: 10px;bottom: 5px;z-index: 30;}

.indexList li{float: left;margin-right: 5px;padding: 2px 4px;border: 2px solid black;background: grey;cursor: pointer;}

.indexList .indexOn{background: red;font-weight: bold;color: white;}

puss in boots1

puss in boots2

puss in boots3

puss in boots4

puss in boots5

1

2

3

4

5

var curIndex = 0; //当前index

//  alert(imgLen);

// 定时器自动变换2.5秒每次

var autoChange = setInterval(function(){

if(curIndex < $(".imgList li").length-1){

curIndex ++;

}else{

curIndex = 0;

}

//调用变换处理函数

changeTo(curIndex);

},2500);

$(".indexList").find("li").each(function(item){

$(this).hover(function(){

clearInterval(autoChange);

changeTo(item);

curIndex = item;

},function(){

autoChange = setInterval(function(){

if(curIndex < $(".imgList li").length-1){

curIndex ++;

}else{

curIndex = 0;

}

//调用变换处理函数

changeTo(curIndex);

},2500);

});

});

function changeTo(num){

$(".imgList").find("li").removeClass("imgOn").hide().eq(num).fadeIn().addClass("imgOn");

$(".infoList").find("li").removeClass("infoOn").eq(num).addClass("infoOn");

$(".indexList").find("li").removeClass("indexOn").eq(num).addClass("indexOn");

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值