欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

純JS實(shí)現(xiàn)輪播圖的示例分析

這篇文章主要介紹了純JS實(shí)現(xiàn)輪播圖的示例分析,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

成都創(chuàng)新互聯(lián)公司專注于陽東企業(yè)網(wǎng)站建設(shè),自適應(yīng)網(wǎng)站建設(shè),商城開發(fā)。陽東網(wǎng)站建設(shè)公司,為陽東等地區(qū)提供建站服務(wù)。全流程定制制作,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)

如下代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>圖片輪播的效果</title>
  <style type="text/css">
    * {
      margin: 0;
      padding: 0;
      text-decoration: none;
    }
    body {
      padding: 20px;
    }
    #container {
      position: relative;
      width: 600px;
      height: 400px;
      border: 3px solid #333;
      overflow: hidden;
    }
    #list {
      position: absolute;
      z-index: 1;
      width: 4200px;
      height: 400px;
    }
    #list img {
      float: left;
      width: 600px;
      height: 400px;
    }
    #buttons {
      position: absolute;
      left: 250px;
      bottom: 20px;
      z-index: 2;
      height: 10px;
      width: 100px;
    }
    #buttons span {
      float: left;
      margin-right: 5px;
      width: 10px;
      height: 10px;
      border: 1px solid #fff;
      border-radius: 50%;
      background: #333;
      cursor: pointer;
    }
    #buttons .on {
      background: orangered;
    }
    .arrow {
      position: absolute;
      top: 180px;
      z-index: 2;
      display: none;
      width: 40px;
      height: 40px;
      font-size: 36px;
      font-weight: bold;
      line-height: 39px;
      text-align: center;
      color: #fff;
      background-color: RGBA(0, 0, 0, .3);
      cursor: pointer;
    }
    .arrow:hover {
      background-color: RGBA(0, 0, 0, .7);
    }
    #container:hover .arrow {
      display: block;
    }
    #prev {
      left: 20px;
    }
    #next {
      right: 20px;
    }
  </style>
</head>
<body>
<div id="container">
  <div id="list" >
    <img src="/upload/otherpic70/76902.jpg" alt="無縫滾動(dòng)" />
    <img src="/upload/otherpic70/76902.jpg" alt="無縫滾動(dòng)" />
    <img src="/upload/otherpic70/76903.jpg" alt="無縫滾動(dòng)" />
    <img src="/upload/otherpic70/76904.jpg" alt="無縫滾動(dòng)" />
    <img src="/upload/otherpic70/76905.jpg" alt="無縫滾動(dòng)" />
    <img src="/upload/otherpic70/76906.jpg" alt="無縫滾動(dòng)" />
    <img src="/upload/otherpic70/76906.jpg" alt="無縫滾動(dòng)" />
  </div>
  <div id="buttons">
    <span index="1" class="on"></span>
    <span index="2"></span>
    <span index="3"></span>
    <span index="4"></span>
    <span index="5"></span>
  </div>
  <a href="javascript:;" rel="external nofollow" rel="external nofollow" id="prev" class="arrow">&lt;</a>
  <a href="javascript:;" rel="external nofollow" rel="external nofollow" id="next" class="arrow">&gt;</a>
</div>
<script type="text/javascript">
  window.onload=function(){
    var container = document.getElementById("container");
    var list = document.getElementById("list");
    var buttons = document.getElementById("buttons").getElementsByTagName('span');
    var prev = document.getElementById("prev");
    var next = document.getElementById("next");
    var index = 1;
   function animate(offset){
     var newLeft = parseInt(list.style.left) + offset;
     list.style.left = newLeft + 'px';
     if(newLeft<-3000){
       list.style.left= -600 +'px';
     }
     if(newLeft>-600){
       list.style.left = -3000 + 'px';
     }
   }
   function buttonsshow(){
     for(var i =0; i<buttons.length;i++){
       if(buttons[i].className == 'on'){
         buttons[i].className='';
       }
     }
     buttons[index-1].className='on';
   }
   prev.onclick = function(){
     index-=1;
     if(index<1)
     {
       index=5;
     }
     buttonsshow();
     animate(600);
   };
   next.onclick = function(){
     index+=1;
     if(index>5){
       index=1;
     }
     buttonsshow();
     animate(-600);
   };
   //自動(dòng)播放
   var timer;
    function play(){
      timer= setInterval(function(){
        next.onclick();
      },1000)
    }
    play();
    function stop(){
      clearInterval(timer);
    }
    container.onmouseover=stop;
    container.onmouseout=play;
for(var i=0; i<buttons.length; i++){
  ( function(i){
      buttons[i].onclick=function(){
        var clickindex= parseInt(this.getAttribute('index'));
        var offset = 600*(index-clickindex);
        animate(offset);
        index = clickindex;
        buttonsshow();
      }
  })(i);
}
  }
</script>
</body>
</html>

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“純JS實(shí)現(xiàn)輪播圖的示例分析”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!

文章標(biāo)題:純JS實(shí)現(xiàn)輪播圖的示例分析
文章來源:http://aaarwkj.com/article24/pcscje.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)定制網(wǎng)站、靜態(tài)網(wǎng)站、營(yíng)銷型網(wǎng)站建設(shè)、建站公司、品牌網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化
日本国产一区二区三区在线观看| 日本一区二区高清在线观看| 婷婷色悠悠,色悠悠激情啪啪| 国产精品国产三级国av麻豆| 97成品视频在线播放| 风韵犹存丰满大屁股熟妇| 91亚洲精品久久久蜜桃网站| 国产一级内射麻豆91| 精品爆白浆一区二区三区| 国产情色自拍在线观看| 亚洲日本韩国在线免费| 欧美日韩国产激情高清| 亚洲精品丝袜成人偷拍| 色偷偷亚洲精品一区二区| 永久免费成人在线视频| 久国产亚洲精品久久久极品| 亚洲国产日韩中文字幕| 亚洲一区二区三区熟女av| 国产精品欧美一区久久| 欧美大片在线观看高清| 国内一级黄色片免费观看| 国产乱国产乱老熟部视频| av东京热免费看一区| 国产精彩在线视频成人在线| 国产精品久久中文字幕网| 97色伦综合在线欧美| 国产午夜福利片新视觉| 日韩黄色大片免费在线观看| 免费av不卡一区二区| 色花堂国产精品第二页| 久久精品少妇人妻视频| 国产一级黄色录像大片| 亚洲综合色日本日b网| 亚洲国产av福利久久| 观看亚洲一区二区三区大片| 成年午夜福利片在线观看| 人人妻人人澡人人爽人人老司机| 91精品国内手机在线高清| 国产精品毛片一区内射| 人人人妻人人澡人人爽e| 久久91亚洲精品久久91|