茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    jQuery實現(xiàn)選項聯(lián)動輪播效果
    來源:易賢網(wǎng) 閱讀:1362 次 日期:2016-07-08 09:45:44
    溫馨提示:易賢網(wǎng)小編為您整理了“jQuery實現(xiàn)選項聯(lián)動輪播效果”,方便廣大網(wǎng)友查閱!

    下面小編就為大家?guī)硪黄猨Query實現(xiàn)選項聯(lián)動輪播效果【附實例】。小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考

    <!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="">

     <link rel="stylesheet" href="css/baner.css">

     <script src="js/jquery-1.11.3.js"></script>

     <script src="js/index.js"></script>

     <title>JQ輪播三級連鎖</title>

     </head>

     <body>

      <div class="parent">

       <div class="top">

        <p>

          <a href="">創(chuàng)意空間</a>

          <a href="">永恒的愛</a>

          <a href="">浪漫真情</a>

          <a href="">珍貴獨特</a>

        </p>

       </div>

       <div class="fours">

        <a href=""><img src="img/1.jpg" alt=""></a>

        <a href=""><img src="img/2.jpg" alt=""></a>

        <a href=""><img src="img/3.jpg" alt=""></a>

        <a href=""><img src="img/4.jpg" alt=""></a>

       </div>

      </div>

     </body>

    </html>

    CSS

    *{

      border:none;

      margin: 0;

      padding: 0;

      list-style: none;

      outline: none;

    }

    html,body{

      width: 100%;

      height: 100%;

    }

    /*方法二*/

    body{

      display: flex;

      align-items: center;/****水平居中****/

      justify-content: center;/*垂直居中*/

    }

    .parent{

      width: 750px;

      height: 400px;

      /*方法一*/

      /*margin: 0 auto;*/

      /*position: relative;*/

      /*top: 50%;*/

      /*margin-top: -200px;*/

    }

    /*輪播*/

    .top p{

      width: 90%;

      margin: 0 auto;

    }

    .top p a{

      display: inline-block;

      line-height: 30px;

      width: 23%;

      padding: 10px 0;

      text-align: center;

      text-decoration: none;

      border: 2px solid transparent;

      color: slategray;

    }

    .top p a.selected{

      border: 2px solid #e4393c;

      color: #e4393c;

    }

    /*圖片*/

    .fours{

      width: 650px;

      margin: 0 auto;

      height: 300px;

      position: relative;

      margin-top: 30px;

    }

    .fours a{

      position: absolute;

    }

    JS

    定義變量和定時器,變量等價于eq(index)中index,自動輪播是可以的,關(guān)鍵在于,鼠標(biāo)進(jìn)入選項卡區(qū)域時候,怎么對應(yīng)想要的輪播畫面,

    方法:停止定時器,獲取當(dāng)前選項卡下標(biāo),匹配對應(yīng)的輪播畫面顯示出來。

    var a=0;

    var t=null;

    $(function(){

      $('.fours>a:not(:first-child)').hide();

      t=setInterval("autoMove()",2000);

      //鼠標(biāo)進(jìn)入輪播停止

      $('.parent').hover(function(){clearInterval(t)},function(){t=setInterval("autoMove()",2000);});

    // 當(dāng)鼠標(biāo)進(jìn)去對應(yīng)選項時候圖片對應(yīng)變化

      $(".top p>a").hover(function(){

       clearInterval(t);

       var num=$(this).index();

       showThis(num);

      //console.log(num);

      })

    });

    function autoMove(){

     a++;

     if(a>=4){

      a=0;

     }

     play(a);

    }

    function play(a){

      $('.fours>a').filter(":visible").fadeOut(500).parent().children().eq(a).fadeIn(1000);

      $('.top p a').eq(a).addClass("selected").siblings().removeClass("selected");

    }

    //鼠標(biāo)進(jìn)入的情況

    function showThis(sum){

      $(".fours>a").eq(sum).fadeIn(1000).siblings().fadeOut(500);

      $(".top p a").eq(sum).addClass("selected").siblings().removeClass("selected");

    }

    以上這篇jQuery實現(xiàn)選項聯(lián)動輪播效果【附實例】就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考

    更多信息請查看網(wǎng)絡(luò)編程
    易賢網(wǎng)手機(jī)網(wǎng)站地址:jQuery實現(xiàn)選項聯(lián)動輪播效果
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報班

    • 報班類型
    • 姓名
    • 手機(jī)號
    • 驗證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機(jī)站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報警專用圖標(biāo)