图片轮播图_点击左右按钮切换_轮播自由控制效果jq实现
前端  /  管理员 发布于 5年前   561
<style type="text/css"> .img-scroll { position:relative; margin:20px auto; width:100%;} .img-scroll .prev,.img-scroll .next { position:absolute;top: 200px;color: #999;font-size: 60px;} .img-scroll .prev { left:0;cursor:pointer;} .img-scroll .next { right:0;cursor:pointer;} .img-list { position:relative; width:320px;height: 635px; margin-left:75px; overflow:hidden} .img-list ul { width:100%;} .img-list li { float:left; display:inline; width:100%;height:100%; margin-right:10px; background-color:#BDBDDF; text-align:center;} </style> <div class="img-scroll"> <span class="prev"><</span> <span class="next">></span> <div class="img-list"> <ul> <li><img style="width:100%;" src="images/005-1.png"></li> <li><img style="width:100%;" src="images/005-2.png"></li> <li><img style="width:100%;" src="images/005-3.png"></li> <li><img style="width:100%;" src="images/005-4.png"></li> </ul> </div> </div> <script type="text/javascript"> function DY_scroll(wraper,prev,next,img,speed,or) { var wraper = $(wraper); var prev = $(prev); var next = $(next); var img = $(img).find('ul'); var w = img.find('li').outerWidth(true); var s = speed; next.click(function() { img.animate({'margin-left':-w},function() { img.find('li').eq(0).appendTo(img); img.css({'margin-left':0}); }); }); prev.click(function() { img.find('li:last').prependTo(img); img.css({'margin-left':-w}); img.animate({'margin-left':0}); }); if (or == true) { ad = setInterval(function() { next.click();},s*1000); wraper.hover(function(){clearInterval(ad);},function(){ad = setInterval(function() { next.click();},s*1000);}); } } DY_scroll('.img-scroll','.prev','.next','.img-list',3,false);// true为自动播放,不加此参数或false就默认不自动 </script>
效果图就不贴了 需要的自己试试 改改就能用
博主 在
2023年国务院办公厅春节放假通知:1月21日起休7天中评论 @ xiaoB 你只管努力,剩下的叫给天意;天若有情天亦老,..xiaoB 在
2023年国务院办公厅春节放假通知:1月21日起休7天中评论 会不会春节放假后又阳一次?..BUG4 在
你翻墙过吗?国内使用vpn翻墙可能会被网警抓,你需了解的事中评论 不是吧?..博主 在
go语言+beego框架中获取get,post请求的所有参数中评论 @ t1 直接在router.go文件中配就ok..Jade 在
如何在MySQL查询中获得当月记录中评论 Dear zongscan.com team, We can skyroc..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号