欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js實(shí)現(xiàn)鼠標(biāo)單擊Tab表單切換效果

 更新時(shí)間:2018年05月16日 16:17:14   投稿:lijiao  
這篇文章主要為大家詳細(xì)介紹了js實(shí)現(xiàn)鼠標(biāo)單擊Tab表單切換效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了js實(shí)現(xiàn)鼠標(biāo)單擊Tab表單切換展示的具體代碼,供大家參考,具體內(nèi)容如下

代碼:

<!DOCTYPE html> 
<html> 
 <head> 
  <meta charset="utf-8" /> 
  <title></title> 
  <style type="text/css"> 
   *{ 
    padding: 0; 
    margin: 0; 
    border:0; 
   } 
   body{ 
    text-align: center; 
   } 
   ul{ 
    list-style: none; 
   } 
   a{ 
    text-decoration: none; 
    color: #ff6666; 
    font-family: Arial; 
   } 
   .tab-container{ 
    width: 398px; 
    height: 200px; 
    border:1px #ffcccc solid; 
    margin: 0 auto; 
    position: relative; 
    overflow: hidden; 
   } 
   /*tab-head begin*/ 
   .tab-head{ 
    width: 400px; 
    height:30px; 
    left:0; 
    background: #ffcccc; 
    position: absolute; 
    left:-1px;//這里設(shè)置-1是為了li的border與最外層的border重合 
   } 
   .tab-head li{ 
    float:left; 
    height: 29px; 
    line-height: 29px; 
    width: 78px; 
    overflow: hidden; 
    padding: 0 1px; 
    border-bottom: 1px solid #ffcccc; 
    background: #ffeeee; 
   } 
    
   li.select{ 
    background: #fff; 
    padding: 0; 
    border-left: 1px solid #ffcccc; 
    border-right: 1px solid #ffcccc; 
    border-bottom: 1px solid #fff;  
   } 
   /*tab-head end tab-panel begin*/ 
   .tab-panel{ 
    position: relative; 
    width: 100%; 
    height: 85%; 
    top: 15%; 
    -webkit-transition:all 0.01s linear;//切換過(guò)渡效果 
   } 
   .tab-panel section{ 
    position: absolute; 
    display: inline-block; 
    width: 100%; 
    height: 100%; 
   } 
   #panel-1{ 
    left: 0; 
   } 
   #panel-2{ 
    left: 100%; 
   } 
   #panel-3{ 
    left: 200%; 
   } 
   #panel-4{ 
    left: 300%; 
   } 
   #panel-5{ 
    left: 400%; 
   } 
  </style> 
 </head> 
 <body> 
  <div class="tab-container"> 
    <ul class="tab-head"> 
     <li id="1" class="select" onmousedown="$(this)"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Tab1</a></li> 
     <li id="2" onmousedown="$(this)"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Tab2</a></li> 
     <li id="3" onmousedown="$(this)"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Tab3</a></li> 
     <li id="4" onmousedown="$(this)"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Tab4</a></li> 
     <li id="5" onmousedown="$(this)"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Tab5</a></li> 
    </ul> 
    <div id="tab-panel" class="tab-panel"> 
     <section id="panel-1"><p>這是panel-1</p></section>  
     <section id="panel-2"><p>這是panel-2</p></section>  
     <section id="panel-3"><p>這是panel-3</p></section>  
     <section id="panel-4"><p>這是panel-4</p></section>  
     <section id="panel-5"><p>這是panel-5</p></section>    
    </div> 
   </div> 
   <script type="text/javascript"> 
    function $(id){ 
    var lis = document.getElementsByTagName('li'); 
    for (var i = 0; i < lis.length; i++) { 
     lis[i].setAttribute('class',''); 
    }; 
    id.setAttribute('class','select'); 
    var ele = document.getElementById('tab-panel'); 
    ele.style.left=-(id.id-1)+'00%'; 
    } 
   </script> 
 </body> 
</html> 

效果圖:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 微信小程序模板與設(shè)置WXML實(shí)例講解

    微信小程序模板與設(shè)置WXML實(shí)例講解

    這篇文章主要介紹了微信小程序模板與設(shè)置WXML,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-08-08
  • JS創(chuàng)建對(duì)象幾種不同方法詳解

    JS創(chuàng)建對(duì)象幾種不同方法詳解

    這篇文章主要為大家詳細(xì)介紹了javascript創(chuàng)建對(duì)象的幾種不同方法
    2016-03-03
  • chrome瀏覽器如何斷點(diǎn)調(diào)試異步加載的JS

    chrome瀏覽器如何斷點(diǎn)調(diào)試異步加載的JS

    chrome瀏覽器不僅僅可以用來(lái)上網(wǎng),對(duì)于開(kāi)發(fā)人員來(lái)說(shuō),它更像是一款強(qiáng)大的開(kāi)發(fā)輔助工具。今天這篇文章給大家分享在chrome瀏覽器如何斷點(diǎn)調(diào)試異步加載的JS,有需要的可以參考借鑒。
    2016-09-09
  • Js實(shí)現(xiàn)自定義右鍵行為

    Js實(shí)現(xiàn)自定義右鍵行為

    本文主要給大家分享的是一則javascript實(shí)現(xiàn)的自定義右鍵行為的小技巧,非常的簡(jiǎn)單實(shí)用,有相同需求的小伙伴可以參考下。
    2015-03-03
  • Javascript模塊模式分析

    Javascript模塊模式分析

    javascritp模式講解全局變量是魔鬼。在YUI中,我們僅用兩個(gè)全局變量:YAHOO和YAHOO_config。YUI的一切都是使用YAHOO對(duì)象級(jí)的成員或這個(gè)成員作用域內(nèi)的變量。我們建議在你的應(yīng)用程序也使用類(lèi)似的規(guī)則。
    2008-05-05
  • 通過(guò)繼承IHttpHandle實(shí)現(xiàn)JS插件的組織與管理

    通過(guò)繼承IHttpHandle實(shí)現(xiàn)JS插件的組織與管理

    最近,項(xiàng)目中的用到的Js插件越來(lái)越多,有的是用原生javascript寫(xiě)的,有的是調(diào)用的jquery插件,頁(yè)面上Js和Css文件的引用也越來(lái)越混亂,而且Js文件之間還有引用先后的依賴(lài)關(guān)系
    2010-07-07
  • Easyui Tree獲取當(dāng)前選擇節(jié)點(diǎn)的所有頂級(jí)父節(jié)點(diǎn)

    Easyui Tree獲取當(dāng)前選擇節(jié)點(diǎn)的所有頂級(jí)父節(jié)點(diǎn)

    這篇文章主要介紹了Easyui Tree獲取當(dāng)前選擇節(jié)點(diǎn)的所有頂級(jí)父節(jié)點(diǎn),以及easyUI Tree顯示選中節(jié)點(diǎn)的所有父節(jié)點(diǎn)的實(shí)現(xiàn)代碼,需要的朋友可以參考下
    2017-02-02
  • 基于JS實(shí)現(xiàn)文字轉(zhuǎn)語(yǔ)音即文本朗讀

    基于JS實(shí)現(xiàn)文字轉(zhuǎn)語(yǔ)音即文本朗讀

    這篇文章主要為大家詳細(xì)介紹了JavaScript如何利用SpeechSynthesis實(shí)現(xiàn)文字轉(zhuǎn)語(yǔ)音即文本朗讀的功能,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2023-10-10
  • 關(guān)于JavaScript 數(shù)組你應(yīng)該知道的事情(推薦)

    關(guān)于JavaScript 數(shù)組你應(yīng)該知道的事情(推薦)

    這篇文章主要介紹了JavaScript 數(shù)組,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • 微信小程序開(kāi)發(fā)常用功能匯總

    微信小程序開(kāi)發(fā)常用功能匯總

    這篇文章主要介紹了微信小程序開(kāi)發(fā)常用功能,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-02-02

最新評(píng)論