博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
图片轮播源代码
阅读量:4539 次
发布时间:2019-06-08

本文共 1829 字,大约阅读时间需要 6 分钟。

  <!DOCTYPE html>
  <html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title></title>
  <script type="text/javascript" src=""></script>
  <script type="text/javascript">
  var i=0;
  var timer;
  $(function(){
  $(".ig").eq(0).show().siblings().hide();
  showTime();
  $(".tab").hover(function(){
  i=$(this).index();
  Show();
  clearInterval(timer);
  },function(){
  showTime()
  });
  $(".btn1").click(function(){
  clearInterval(timer);
  if(i==0){
  i=5;
  }
  i--;
  Show();
  showTime();
  })
  $(".btn2").click(function(){
  clearInterval(timer);
  if(i==4){
  i=-1;
  }
  i++;
  Show();
  showTime();
  })
  })
  function Show(){
  $(".ig").eq(i).fadeIn(300).siblings().fadeOut(300);
  $(".tab").eq(i).addClass("bg").siblings().removeClass("bg")
  }
  function showTime(){
  timer=setInterval(function(){
  i++;
  if(i==5){
  i=0;
  };
  Show();
  },3000)
  }
  </script>
  <style type="text/css">
  *{margin:0;padding:0;}
  .ig{position:absolute;}
  .btn{position:absolute;
  width:60px;
  height:90px;
  background-color:rgba(0,0,0,0.5)
  color:#fff;
  text-align:center;
  line-height:90px;
  font-size:40px;
  top:95px;
  cursor:pointer;
  }
  .btn2{
  left:580px;
  }
  ul{list-style:none;}
  #tabs{position:absolute;top:260px;left:200px;}
  .tab{width:30px;height:30px;background:#5388e8;float:left;line-height:30px;text-algin:center;color:#fff;margin-right:10px;border-radius:100%;cursor:pointer}
  .bg{background:red;}
  </style>
  </head>
   
  <body>
  <div id="igs">
  <div class="ig"><img src=""></div>
  <div class="ig"><img src=""></div>
  <div class="ig"><img src=""></div>
  <div class="ig"><img src=""></div>
  <div class="ig"><img src=""></div>
  </div>
  <div class="btn btn1"><</div>
  <div class="btn btn2">></div>
  <div id="tabs">
  <div class="tab bg">1</div>
  <div class="tab">2</div>
  <div class="tab">3</div>
  <div class="tab">4</div>
  <div class="tab">5</div>
  </div>
  </body>
  </html>

转载于:https://www.cnblogs.com/chaofei/p/5701393.html

你可能感兴趣的文章
剑指offer : 二维数组中的查找
查看>>
第三章 python基础
查看>>
java基础题
查看>>
[转]人人店短信插件开发
查看>>
[转]c# System.IO.Ports SerialPort Class
查看>>
14. 最长公共前缀
查看>>
Redis文档
查看>>
项目重构
查看>>
(笔试题)和一半的组合数
查看>>
leetcode--Algorithm--Array_Part 1 Easy- 566 Reshape the Matrix
查看>>
AC自动机算法详解 (转载)
查看>>
python3-day5(模块)
查看>>
Linux配置JDK
查看>>
qt 读取xml文件
查看>>
python3之正则表达式
查看>>
Visual Studio提示“无法启动IIS Express Web服务器”的解决方法
查看>>
Java 时间总结
查看>>
jQuery EasyUI 拖放 – 基本的拖动和放置
查看>>
这些年正Android - 母亲
查看>>
[工具] BurpSuite--XssValidator插件
查看>>