鼠标点击按钮图片切换+自动切换+左右按钮点击切换效果上一次在我的文库中分享了点击按钮 图片左右切换轮播效果代码今天主要是分享【鼠标点击按钮 图片进行切换+图片自动切换+点击左右按钮图片进行切换的三种效果的组合代码】。
最后的效果如下
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");});
});
Friendhosting发布了今年黑色星期五促销活动,针对全场VDS主机提供45折优惠码,虚拟主机4折,老用户续费可获9折加送1个月使用时长,优惠后VDS最低仅€14.53/年起,商家支持PayPal、信用卡、支付宝等付款方式。这是一家成立于2009年的老牌保加利亚主机商,提供的产品包括虚拟主机、VPS/VDS和独立服务器租用等,数据中心可选美国、保加利亚、乌克兰、荷兰、拉脱维亚、捷克、瑞士和波...
易探云香港vps主机价格多少钱?香港vps主机租用费用大体上是由配置决定的,我们选择香港vps主机租用最大的优势是免备案vps。但是,每家服务商的机房、配置、定价也不同。我们以最基础配置为标准,综合比对各大香港vps主机供应商的价格,即可选到高性能、价格适中的香港vps主机。通常1核CPU、1G内存、2Mbps独享带宽,价格在30元-120元/月。不过,易探云香港vps主机推出四个机房的优惠活动,...
spinservers是Majestic Hosting Solutions LLC旗下站点,主营国外服务器租用和Hybrid Dedicated等,数据中心在美国达拉斯和圣何塞机房。目前,商家针对圣何塞部分独立服务器进行促销优惠,使用优惠码后Dual Intel Xeon E5-2650L V3(24核48线程)+64GB内存服务器每月仅109美元起,提供10Gbps端口带宽,可以升级至1Gbp...