jquery實現tab選項卡轉場效果(懸停、下方橫線動畫位移),jquerytab

來源:互聯網
上載者:User

jquery實現tab選項卡轉場效果(懸停、下方橫線動畫位移),jquerytab

本文執行個體為大家分享了jquery實現tab選項卡切換展示的具體代碼,供大家參考,具體內容如下

同時實現懸停、下方橫線動畫位移:

代碼:

<sytle>  *{margin:0;padding:0; }  .box{position:relative;font-size:0;}  .box span{display:inline-block;width:150px;height:40px;line-height:40px;text-align:center;background:#eee;font-size:16px;}  .line{position:absolute;width:150px;height:3px;background:#059;left:0;bottom:0;}</style><div class="box" id="switch"> <span class="current">新聞資訊</span>  <span>公司動態</span> <div class="line"></div></div> $(function(){ var $spans=$("#switch span"); $spans.click(function(){   $(this).addClass('current').siblings().removeClass('current');  var index=$spans.index(this);     //$("#content .detail").eq(index).show().siblings().hide();  //$("#fr .bar").eq(index).show().siblings().hide(); })     $spans.mouseover(function(){  var index=$spans.index(this);  var cName=$(this).attr("class");  if(cName!="current"){   if(index==0){    $('.line').animate({'left':'0px'},300);   }else{    $('.line').animate({'left':'150px'},300);   }  }     }) $spans.mouseout(function(){  var index=$spans.index(this);  var cName=$(this).attr("class");  if(cName!="current"){   if(index==0){   $('.line').animate({'left':'150px'},300);   }else{   $('.line').animate({'left':'0px'},300);   }    }       })})

以上就是本文的全部內容,希望對大家的學習有所協助,也希望大家多多支援幫客之家。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.