切换鼠标点击按钮图片切换自动切换左右按钮点击切换效果

鼠标图片  时间:2021-04-19  阅读:()

鼠标点击按钮图片切换+自动切换+左右按钮点击切换效果上一次在我的文库中分享了点击按钮 图片左右切换轮播效果代码今天主要是分享【鼠标点击按钮 图片进行切换+图片自动切换+点击左右按钮图片进行切换的三种效果的组合代码】。

最后的效果如下

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");});

});

阿里云香港 16核32G 20M 999元/月

阿里云香港配置图提速啦是成立于2012年的十分老牌的一个商家这次给大家评测的是 阿里云香港 16核32G 20M 这款产品,单单说价格上就是十分的离谱原价8631元/月的现价只要 999元 而且还有个8折循环优惠。废话不多说直接进入正题。优惠时间 2021年8月20日-2021年9月20日 优惠码 wn789 8折优惠阿里云香港BGP专线 16核32G 10M带宽 优惠购买 399元购买链接阿里云...

iWebFusion:独立服务器月付57美元起/5个机房可选,10Gbps服务器月付149美元起

iWebFusion(iWFHosting)在部落分享过很多次了,这是成立于2001年的老牌国外主机商H4Y旗下站点,提供的产品包括虚拟主机、VPS和独立服务器租用等等,其中VPS主机基于KVM架构,数据中心可选美国洛杉矶、北卡、本德、蒙蒂塞洛等。商家独立服务器可选5个不同机房,最低每月57美元起,而大流量10Gbps带宽服务器也仅149美元起。首先我们分享几款常规服务器配置信息,以下机器可选择5...

弘速云20.8元/月 ,香港云服务器 2核 1g 10M

弘速云元旦活动本公司所销售的弹性云服务器、虚拟专用服务器(VPS)、虚拟主机等涉及网站接入服务的云产品由具备相关资质的第三方合作服务商提供官方网站:https://www.hosuyun.com公司名:弘速科技有限公司香港沙田直营机房采用CTGNET高速回国线路弹性款8折起优惠码:hosu1-1 测试ip:69.165.77.50​地区CPU内存硬盘带宽价格购买地址香港沙田2-8核1-16G20-...

鼠标图片为你推荐
访问chrome曲目itunes单击media孩子apple支持ipad南京医科大学合同管理系统Descriptionios5windows键是哪个Windows键是哪个键啊?iphone连不上wifi为什么苹果手机连不上wifi微信都发不出去?iexplore.exe应用程序错误iexplore.exe应用程序错误
虚拟主机测评 高防服务器租用 美国加州vps 如何注册网站域名 greengeeks stablehost nerd ixwebhosting java虚拟主机 godaddy域名证书 河南移动邮件系统 hkg 徐正曦 广州服务器 免费申请个人网站 太原联通测速 重庆电信服务器托管 全能空间 国外免费云空间 免备案cdn加速 更多