jquery簡(jiǎn)單實(shí)現(xiàn)帶漸顯效果的選項(xiàng)卡菜單代碼
本文實(shí)例講述了jquery簡(jiǎn)單實(shí)現(xiàn)帶漸顯效果的選項(xiàng)卡菜單代碼。分享給大家供大家參考。具體如下:
帶漸顯效果的選項(xiàng)卡菜單,使用了jQuery共同完成的效果,鼠標(biāo)點(diǎn)擊選項(xiàng)卡之后,出現(xiàn)漸變(淡入淡出效果),讓網(wǎng)頁看上去更生動(dòng)。
運(yùn)行效果截圖如下:

在線演示地址如下:
http://demo.jb51.net/js/2015/jquery-cha-style-tab-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>
<title>帶漸顯效果的選項(xiàng)卡菜單</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<style type="text/css">
body {
background: #f0f0f0;
margin: 0;
padding: 0;
font: 10px normal Verdana, Arial, Helvetica, sans-serif;
color: #444;
}
h1 {
font-size: 3em;
margin: 20px 0;
}
.container {
width: 500px;
margin: 10px auto;
}
ul.tabs {
margin: 0;
padding: 0;
float: left;
list-style: none;
height: 32px;
border-bottom: 1px solid #999;
border-left: 1px solid #999;
width: 100%;
}
ul.tabs li {
float: left;
margin: 0;
padding: 0;
height: 31px;
line-height: 31px;
border: 1px solid #999;
border-left: none;
margin-bottom: -1px;
background: #e0e0e0;
overflow: hidden;
position: relative;
}
ul.tabs li a {
text-decoration: none;
color: #000;
display: block;
font-size: 1.2em;
padding: 0 20px;
border: 1px solid #fff;
outline: none;
}
ul.tabs li a:hover {
background: #ccc;
}
html ul.tabs li.active, html ul.tabs li.active a:hover {
background: #fff;
border-bottom: 1px solid #fff;
}
.tab_container {
border: 1px solid #999;
border-top: none;
clear: both;
float: left;
width: 100%;
background: #fff;
-moz-border-radius-bottomright: 5px;
-khtml-border-radius-bottomright: 5px;
-webkit-border-bottom-right-radius: 5px;
-moz-border-radius-bottomleft: 5px;
-khtml-border-radius-bottomleft: 5px;
-webkit-border-bottom-left-radius: 5px;
}
.tab_content {
padding: 20px;
font-size: 1.2em;
}
.tab_content h2 {
font-weight: normal;
padding-bottom: 10px;
border-bottom: 1px dashed #ddd;
font-size: 1.8em;
}
.tab_content h3 a {
color: #254588;
}
.tab_content img {
float: left;
margin: 0 20px 20px 0;
border: 1px solid #ddd;
padding: 5px;
}
</style>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
return false;
});
});
</script>
</head>
<body>
<div class="container">
<ul class="tabs">
<li class="active"><a href="#tab1">tab1</a></li>
<li><a href="#tab2" id="">tab2</a></li>
<li><a href="#tab3">tab3</a></li>
<li><a href="#tab4">tab4</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content" style="display: block;">
111111111111111
</div>
<div id="tab2" class="tab_content" style="display: none;">
222222222222222
</div>
<div id="tab3" class="tab_content" style="display: none;">
333333333333333
</div>
<div id="tab4" class="tab_content" style="display: none;">
444444444444444
</div>
</div>
</div>
</body>
</html>
希望本文所述對(duì)大家的jquery程序設(shè)計(jì)有所幫助。
- jquery實(shí)現(xiàn)通用的內(nèi)容漸顯Tab選項(xiàng)卡效果
- jQuery實(shí)現(xiàn)的感應(yīng)鼠標(biāo)懸停圖片色彩漸顯效果
- jquery漸隱漸顯的圖片幻燈閃爍切換實(shí)現(xiàn)方法
- jQuery頁面圖片伴隨滾動(dòng)條逐漸顯示的小例子
- jquery 圖片Silhouette Fadeins漸顯效果
- jQuery動(dòng)態(tài)效果顯示人物結(jié)構(gòu)關(guān)系圖的方法
- jquery實(shí)現(xiàn)簡(jiǎn)單實(shí)用的彈出層效果代碼
- jQuery實(shí)現(xiàn)帶漸顯效果的人物多級(jí)關(guān)系圖代碼
相關(guān)文章
jQuery插件FusionCharts繪制2D柱狀圖和折線圖的組合圖效果示例【附demo源碼】
這篇文章主要介紹了jQuery插件FusionCharts繪制2D柱狀圖和折線圖的組合圖效果,結(jié)合完整實(shí)例形式分析了jQuery使用插件FusionCharts載入xml格式數(shù)據(jù)繪制柱狀圖與折線圖組合圖效果的操作步驟與相關(guān)實(shí)現(xiàn)技巧,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2017-04-04
在瀏覽器中實(shí)現(xiàn)圖片粘貼的jQuery插件-- pasteimg使用指南
這篇文章主要介紹了在瀏覽器中實(shí)現(xiàn)圖片粘貼的jQuery插件-- pasteimg使用指南,需要的朋友可以參考下2014-12-12
jquery attr 設(shè)定src中含有&(宏)符號(hào)問題的解決方法
今天在用 jquery 的attr 方法設(shè)定 iframe的src屬性的時(shí)候遇到了一個(gè)奇怪的為題,現(xiàn)在把問題及解決方面寫出來,讓遇到同樣問題的人不要在走彎路。2011-07-07
jquery計(jì)算鼠標(biāo)和指定元素之間距離的方法
這篇文章主要介紹了jquery計(jì)算鼠標(biāo)和指定元素之間距離的方法,涉及jQuery針對(duì)頁面位置屬性與鼠標(biāo)事件的相關(guān)操作技巧,需要的朋友可以參考下2015-06-06
Jquery 動(dòng)態(tài)添加按鈕實(shí)現(xiàn)代碼
在測(cè)量中 面是有不同的點(diǎn)組成,在輸入的時(shí)候 需要?jiǎng)討B(tài)的添加 不同點(diǎn)的坐標(biāo)值2010-05-05
jQuery 打造動(dòng)態(tài)漸變按鈕 詳細(xì)圖文教程
這是寫給web設(shè)計(jì)者和前端開發(fā)者的教程,我們將演示如何使用Photoshop創(chuàng)建按鈕的sprite圖,然后是如何使用jQurey打造動(dòng)態(tài)漸變效果。2010-04-04

