鼠标点击按钮图片切换+自动切换+左右按钮点击切换效果上一次在我的文库中分享了点击按钮 图片左右切换轮播效果代码今天主要是分享【鼠标点击按钮 图片进行切换+图片自动切换+点击左右按钮图片进行切换的三种效果的组合代码】。
最后的效果如下
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");});
});
全球独立服务器、站群多IP服务器、VPS(哪个国家都有),香港、美国、日本、韩国、新加坡、越南、泰国、加拿大、英国、德国、法国等等99元起步,湘南科技郴州市湘南科技有限公司官方网址:www.xiangnankeji.cn产品内容:全球独立服务器、站群多IP服务器、VPS(哪个国家都有),香港、美国、日本、韩国、新加坡、越南、泰国、加拿大、英国、德国、法国等等99元起步,湘南科技VPS价格表:独立服...
有在六月份的时候也有分享过新网域名注册商发布的域名促销活动(这里)。这不在九月份发布秋季域名促销活动,有提供年付16元的.COM域名,同时还有5个+的特殊后缀的域名是免费的。对于新网服务商是曾经非常老牌的域名注册商,早年也是有在他们家注册域名的。我们可以看到,如果有针对新用户的可以领到16元的.COM域名。包括还有首年免费的.XYZ、.SHOP、Space等等后缀的域名。除了.COM域名之外的其他...
韩国云服务器哪个好?韩国云服务器好用吗?韩国是距离我国很近的一个国家,很多站长用户在考虑国外云服务器时,也会将韩国云服务器列入其中。绝大部分用户都是接触的免备案香港和美国居多,在加上服务器确实不错,所以形成了习惯性依赖。但也有不少用户开始寻找其它的海外免备案云服务器,比如韩国云服务器。下面云服务器网(yuntue.com)就推荐最好用的韩国cn2云服务器,韩国CN2云服务器租用推荐。为什么推荐租用...