JQuery的图片的切换和自动轮播
2017-10-10 19:25
323 查看
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script> <style> *{ margin: 0; padding: 0; text-align: center; } .clear:after{ content: "\200B"; display: block; width: 0; height: 0; clear: both; } ul{ width: 820px; margin: 200px auto 50px; } img{ display: block; width: 100%; height: 100%; } li{ list-style: none; width: 256px; height: 144px; float: left; } li:nth-child(2){ width: 300px; height: 180px; margin-top: -20px; } </style> </head> <body> <ul class="clear"> <li><img src="3.jpg"></li> <li><img src="1.jpg"></li> <li><img src="2.jpg"></li> </ul> <button>上一个</button> <button>下一个</button> <!--<script> var timmer; function run(){ timmer=setInterval(function(){ $("ul li").eq(0).appendTo($("ul")); },1000); } run(); $("button").eq(1).click(function(){ clearInterval(timmer); $("ul li").eq(0).appendTo($("ul")); setTimeout(function(){ run(); },2000) }); $("button").eq(0).click(function(){ clearInterval(timmer); $("ul li:last-child").prependTo($("ul")); setTimeout(function(){ run(); },2000) }); </script>--> <script> var timmer; function run(){ timmer=setInterval(function(){ $("ul li:first-child").appendTo($("ul")); },1000); } clearInterval(timmer); run(); $("button").eq(1).click(function(){ clearInterval(timmer); $("ul li:first-child").appendTo($("ul")); clearInterval(timmer); run(); }); $("button").eq(0).click(function(){ clearInterval(timmer); $("ul li:last-child").prependTo($("ul")); clearInterval(timmer); run(); }); </script> </body> </html>
相关文章推荐
- jQuery插件Flexslider实现图片轮播、图文结合滑动切换效果
- jQuery插件实现带圆点的焦点图片轮播切换
- jquery带有索引按钮且自动轮播切换特效代码分享
- jQuery-图片轮播-随意切换图片
- 基于jquery的图片轮播 tab切换组件
- 原生js+css3实现图片自动切换,图片轮播
- jquery+js 图片切换和自动切换
- JQuery中图片自动切换和手动切换
- jquery带有索引按钮且自动轮播切换特效代码分享
- JS图片自动和可控的轮播切换特效
- jQuery - 广告图片轮播切换
- jquery 图片自动切换
- jquery实现的带缩略图的焦点图片切换(自动播放/响应鼠标动作)
- jQuery--仿迅雷图片轮播切换效果
- 基于jquery的图片轮播 tab切换组件
- jQuery图片自动切换(带左右切换按钮)
- JQuery实现图片轮播切换效果--水平切换/垂直切换
- jquery banner广告幻灯片图片轮播切换,模仿实现当当网滚动广告效果
- android 视频和图片切换并进行自动轮播