jquery實現超簡潔的TAB選項卡效果代碼,jquerytab

來源:互聯網
上載者:User

jquery實現超簡潔的TAB選項卡效果代碼,jquerytab

本文執行個體講述了jquery實現超簡潔的TAB選項卡效果代碼。分享給大家供大家參考。具體如下:

這是一款超簡潔的TAB選項卡,個人覺得有點太簡單,簡單的有點不習慣,美化修飾一下其實效果更好。實際上應該為點擊過的TAB添加一個背景色,區分一下,這樣比較好。

先來看看運行效果:

線上示範地址如下:

http://demo.jb51.net/js/2015/jquery-easy-tab-cha-menu-codes/

具體代碼如下:

<!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>超簡潔的TAB選項卡</title><style>body {font:normal 12px/20px simsun; margin:0 auto; padding:0;} * {margin: 0px; padding: 0px;}h4{font-size:14px;}h5{font-size:12px;}img {border:none;}ul,li{list-style-type:none;}a{text-decoration:none;}a:link{text-decoration:none;}a:hover{text-decoration:underline; color:#ffae00;}.menu li{width:60px; height:30px; text-align:center; line-height:30px; float:left; cursor:pointer;}.menu li:hover, .menu li.on{color:#f00;}.cont{width:180px; height:100px; border:1px solid #666666; clear:both;}</style><script type="text/javascript" src="jquery-1.6.2.min.js"></script><script type="text/javascript"> $(document).ready(function(){  $(".menu li").click(function(){     var Num=$(this).index("li");  $(".menu li").removeClass("on").eq(Num).addClass("on");  $(".cont").hide().eq(Num).show();    });        });</script></head><body><div class="tab">  <ul class="menu"> <li class="on">北歐之旅</li> <li>音樂維也納</li> <li>天堂瑞士</li> </ul> <div class="cont">北歐之旅</div> <div class="cont" style="display:none;">音樂維也納</div> <div class="cont" style="display:none;">天堂瑞士</div></div></body></html>

希望本文所述對大家的jquery程式設計有所協助。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.