jQuery超簡單選項卡完整實例
本文實例講述了jQuery實現(xiàn)的超簡單選項卡效果。分享給大家供大家參考。具體如下:
這是一款基于jQuery的選項卡示例,比較實用的一個實例,希望通過本文讓大家掌握如何使用jQuery創(chuàng)建一個選項卡標簽,這是目前WEB前端設(shè)計比較流行的一款功能。
運行效果截圖如下:
在線演示地址如下:
http://demo.jb51.net/js/2015/jquery-simple-nav-cha-demo/
具體代碼如下:
<!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>jQuery選項卡實戰(zhàn)</title> <style> *{margin:0; padding:0;font-family:"宋體",Arial, Helvetica, sans-serif; font-size:12px} .ts{ width:50%; margin:0 auto} .ts .tsHead{clear:both; height:27px;background:url(images/titLine.gif) repeat-x left bottom; border-left:1px solid #88AAD6; border-right:1px solid #88AAD6; border-top:1px solid #88AAD6} .ts .titLeft{float:left; height:27px;font-size:1px; width:12px;;background:url(images/titLeft.gif) no-repeat} .ts .titOp{float:left; height:21px; padding:5px 0 0} .ts .titOp li{ float:left; width:100px;height:15px; padding:5px 0 0; margin:0 0 0 3px;border:1px solid #88AAD6; border-bottom:1px solid #fff;background:#eeeeff; color:#999;text-align:center; cursor:default} .ts .titOp li.current{ background:#fff;color:#290052; } .ts .titRight{float:right; height:26px;font-size:1px; width:32px;;background:url(images/titRight.gif) no-repeat} .ts .line{border-left:1px solid #88AAD6;border-right:1px solid #88AAD6;clear:both; height:13px; line-height:13px; padding:5px; background:#E9F9FE} .ts .tsMb{border:1px solid #88AAD6; border-top:none; padding:10px; height:120px; min-height:100px; font-weight:bold} </style> <script type="text/javascript" src="jquery-1.6.2.min.js"></script> <script> $(function(){ $("#tsMb div:not(:first)").hide(); $("#titOp li").each(function(index){ $(this).mouseover( function(){ $("#titOp li.current").removeClass("current"); $(this).addClass("current"); $("#tsMb > div:visible").hide(); $("#tsMb div:eq(" + index + ")").show(); }) }) }) </script> </head> <body> <div style="clear:both; height:30px"></div> <div class="ts"> <div class="tsHead"> <div class="titLeft"></div> <div class="titOp" id="titOp"> <ul> <li class="current">腳本調(diào)試器</li> <li>樣式調(diào)試器</li> <li>DOM調(diào)試器</li> </ul> </div> <div class="titRight"></div> </div> <div class="tsMb" id="tsMb"> <div>腳本</div> <div>樣式</div> <div>DOM</div> </div> </div> </body> </html>
希望本文所述對大家的jQuery程序設(shè)計有所幫助。
相關(guān)文章
jQuery.autocomplete 支持中文輸入(firefox)修正方法
jQuery.autocomplete 是jquery的流行插件,,能夠很好的實現(xiàn)輸入框的自動完成(autocomplete)、建議提示(input suggest)功能,支持ajax數(shù)據(jù)加載。2011-03-03jQuery中bind,live,delegate與one方法的用法及區(qū)別解析
本篇文章主要是對jQuery中bind,live,delegate與one方法的用法及區(qū)別進行了詳細的介紹,需要的朋友可以過來參考下,希望對大家有所幫助2013-12-12基于jquery+thickbox仿校內(nèi)登錄注冊框
近日,客戶說他想要個類似于人人網(wǎng)(以前為校內(nèi))的登錄框效果,于是上網(wǎng)搜了下,發(fā)現(xiàn)有一個仿得比較好的,于是就拿過來用了用。2010-06-06jquery ajax提交表單數(shù)據(jù)的兩種方式
貌似AJAX越來越火了,作為一個WEB程序開發(fā)者要是不會這個感覺就要落伍,甚至有可能在求職的時候?qū)冶惶蕴?。我也是一個WEB程序開發(fā)者,當然我也要“隨波逐流”一把,不然飯碗不保啊!2009-11-11