鼠标点击按钮图片切换+自动切换+左右按钮点击切换效果上一次在我的文库中分享了点击按钮 图片左右切换轮播效果代码今天主要是分享【鼠标点击按钮 图片进行切换+图片自动切换+点击左右按钮图片进行切换的三种效果的组合代码】。
最后的效果如下
Html代码部分
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>图片轮播效果制作</title>
<l ink rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/style.js"></script>
</head>
<body>
<divclass="banner">
<ulclass="pic">
<l i>
<a href="#"><img src="image s/1.jpg" alt="美女" width ="350" height="495"></a>
</l i>
<l i>
<a href="#"><img src="image s/2.jpg" alt="美女" width ="350" height="495"></a>
</l i>
<l i>
<a href="#"><img src="image s/3.jpg" alt="美女" width ="350" height="495"></a>
</l i>
<l i>
<a href="#"><img src="image s/4.jpg" alt="美女" width ="350" height="495"></a>
</l i>
<l i>
<a href="#"><img src="image s/5.jpg" alt="美女" width ="350" height="495"></a>
</l i>
</ul>
<ulclass="anniu">
<l iclass="on"></l i>
<l i></l i>
<l i></l i>
<l i></l i>
<l i></l i>
</ul>
<ulclass="lr">
<l iclass="pre"><a href="#"><</a></l i>
<l iclass="next"><a href="#">></a></l i>
</ul>
</div>
</body>
</html>
Css代码部分
*{margin:0px;padding:0px}
l i{l ist-style:none}a{text-decoration:none}img{border:0px}
.banner{width:350px;height:495px;margin:100px auto;position:relative;overflow:hidden}.banner .pic{width:9999px;height:495px}
.banner .pic l i{width:350px;height:495px;float: left}
.banner .anniu{width:100px;height:16px;position:absolute; left:165px;top:470px}
.banner .anniu l i{width:16px;height:16px;background:white;float: left;margin:2px;display: inl ine;cursor:pointer;border-radius:100%}
.banner .anniu l i .on{background:red}
.banner . lr{width:350px;height:50px;position:absolute;top:250px;display:none}
.banner . lra{color:white}
.banner . lr .pre{width:20px;height:50px;float: left;background:none repeat scrol l 0px 0px rgba(1,0,0,0.6);text-al ign:center; l ine-height:50px;cursor:pointer}
.banner . lr .next{width:20px;height:50px;float:right;background:none repea tscrol l 0px 0pxrgba(1,0,0,0.6);text-al ign:center; l ine-height:50px;cursor:pointer}
Javascript代码部分
$(function(){
//鼠标滑过b anner左右按钮进行显示和隐藏
$(".banner").hover(function(){
$(". lr").show();
},function(){
$(". lr").hide();
});
//点击下面的小按钮 图片进行左右切换效果
$(".anniul i").cl ick(function(){
$(this).addClass("on").sibl ings().removeClass("on");varnum=$(this). index();
$(".pic").animate({marginLeft:-350*num},"slow");
});
//图片自动轮播效果va r a=0;var automatic=setInterval(function(){a++;a=a%5;
$(".pic").animate({marginLeft:-350*a},"slow");
$(".anniu l i").eq(a).addClass("on").sibl ings().removeClass("on");
},6000);
//点击左右按钮 图片进行切换效果
$(".pre").cl ick(function(){a--;a=(a+5)%5;
$(".pic").animate({marginLeft:-350*a},"slow");
$(".anniu l i").eq(a).addClass("on").sibl ings().removeClass("on");});
$(".next").cl ick(function(){a++;a=a%5;
$(".pic").animate({marginLeft:-350*a},"slow");
$(".anniu l i").eq(a).addClass("on").sibl ings().removeClass("on");});
});
近日CloudCone商家对旗下的大硬盘VPS云服务器进行了少量库存补货,也是悄悄推送了一批便宜VPS云服务器产品,此前较受欢迎的特价20美元/年、1核心1G内存1Gbps带宽的VPS云服务器也有少量库存,有需要美国便宜大硬盘VPS云服务器的朋友可以关注一下。CloudCone怎么样?CloudCone服务器好不好?CloudCone值不值得购买?CloudCone是一家成立于2017年的美国服务...
tmthosting怎么样?tmthosting家本站也分享过多次,之前也是不温不火的商家,加上商家的价格略贵,之到斯巴达商家出现,这个商家才被中国用户熟知,原因就是斯巴达家的机器是三网回程AS4837线路,而且也没有多余的加价,斯巴达家断货后,有朋友发现TMTHosting竟然也在同一机房,所以大家就都入手了TMTHosting家的机器。目前,TMTHosting商家放出了夏季优惠,针对VPS推...
virmach送来了夏季促销,价格低到爆炸,而且在低价的基础上还搞首年8折,也就是说VPS低至7.2美元/年。不过,这里有一点要说明:你所购买的当前的VPS将会在09/30/2021 ~ 04/30/2022进行服务器转移,而且IP还会改变,当前的Intel平台会换成AMD平台,机房也会变动(目前来看以后会从colocrossing切换到INAP和Psychz),采取的是就近原则,原来的水牛城可能...