亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

js實現(xiàn)鼠標單擊Tab表單切換效果

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

本文實例為大家分享了js實現(xiàn)鼠標單擊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;//切換過渡效果 
   } 
   .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> 

效果圖:

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

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

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

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

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

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

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

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

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

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

    Javascript模塊模式分析

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

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

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

    Easyui Tree獲取當前選擇節(jié)點的所有頂級父節(jié)點

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

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

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

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

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

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

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

最新評論