Jquery实现Tab效果
2011-01-26 00:21
211 查看
<!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></title>
<script src="Public/jquery.js" type="text/javascript"></script>
<style type="text/css">
.tab
{
background-color: #FAFAFA;
margin: 5px 8px;
padding: 5px 10px;
}
.tab p span
{
background-color: #EFEFEF;
border: 1px solid #CCCCCC;
cursor: pointer;
margin-right: 6px;
padding: 2px 5px;
}
.tab p span.current
{
background-color: #FAFAFA;
border-bottom-color: #fafafa;
}
.tab p
{
border-bottom: 1px solid #CCCCCC;
font-weight: bold;
padding: 0 10px 2px;
}
.tab li
{
border-bottom: 1px dotted #CCCCCC;
padding-bottom: 3px;
margin: 5px 0;
}
.tab .mhot, .tab.allhot
{
display: none;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$(".tab span:first").addClass("current"); //为第一个SPAN添加当前效果样式
$(".tab ul:not(:first)").hide(); //隐藏其它的UL
$(".tab span").mouseover(function() {
$(".tab span").removeClass("current"); //去掉所有SPAN的样式
$(this).addClass("current");
$(".tab ul").hide();
$("." + $(this).attr("id")).fadeIn('slow');
});
});
</script>
</head>
<body>
<div class="tab">
<p>
<span id="tab1">tab1</span> <span id="tab2">tab2</span> <span id="tab3">tab3</span></p>
<ul class="tab1">
<li>我和我的祖国</li><li>最爱的地方</li><li>我和我</li></ul>
<ul class="tab2">
<li>一花一世办</li><li>一草一天堂</li></ul>
<ul class="tab3">
<li>阿里巴巴</li><li>阿里巴巴</li><li>一草一天堂</li><li>我和我的祖国</li><li>最爱的地方</li></ul>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Public/jquery.js" type="text/javascript"></script>
<style type="text/css">
.tab
{
background-color: #FAFAFA;
margin: 5px 8px;
padding: 5px 10px;
}
.tab p span
{
background-color: #EFEFEF;
border: 1px solid #CCCCCC;
cursor: pointer;
margin-right: 6px;
padding: 2px 5px;
}
.tab p span.current
{
background-color: #FAFAFA;
border-bottom-color: #fafafa;
}
.tab p
{
border-bottom: 1px solid #CCCCCC;
font-weight: bold;
padding: 0 10px 2px;
}
.tab li
{
border-bottom: 1px dotted #CCCCCC;
padding-bottom: 3px;
margin: 5px 0;
}
.tab .mhot, .tab.allhot
{
display: none;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$(".tab span:first").addClass("current"); //为第一个SPAN添加当前效果样式
$(".tab ul:not(:first)").hide(); //隐藏其它的UL
$(".tab span").mouseover(function() {
$(".tab span").removeClass("current"); //去掉所有SPAN的样式
$(this).addClass("current");
$(".tab ul").hide();
$("." + $(this).attr("id")).fadeIn('slow');
});
});
</script>
</head>
<body>
<div class="tab">
<p>
<span id="tab1">tab1</span> <span id="tab2">tab2</span> <span id="tab3">tab3</span></p>
<ul class="tab1">
<li>我和我的祖国</li><li>最爱的地方</li><li>我和我</li></ul>
<ul class="tab2">
<li>一花一世办</li><li>一草一天堂</li></ul>
<ul class="tab3">
<li>阿里巴巴</li><li>阿里巴巴</li><li>一草一天堂</li><li>我和我的祖国</li><li>最爱的地方</li></ul>
</div>
</body>
</html>
相关文章推荐
- jQuery实现的网页右下角tab样式在线客服效果代码
- jQuery实现Tab选项卡切换效果简单演示
- jquery 实现简单tab选项卡效果
- jQuery实现的 “滑动门”(跟随鼠标滑动滑动的tab选项卡)效果
- jQuery实现简单的tab标签页效果
- Jquery 实现Tab效果 思路是js思路
- jquery实现的仿天猫侧导航tab切换效果
- jquery实现TAB选项卡鼠标经过带延迟效果的方法
- jQuery实现Tab选项卡切换效果简单演示
- jQuery实现滚动切换的tab选项卡效果代码
- Jquery封装tab自动切换效果的具体实现
- jQuery实现的Tab滑动选项卡及图片切换(多种效果)小结
- 转:jquery实现tab切换效果及js css ajax推荐
- jquery 简单两步实现tab切换效果
- Jquery实现的tab效果可以指定默认显示第几页
- jquery实现通用的内容渐显Tab选项卡效果
- jQuery实现的一个tab切换效果内部还嵌有切换
- jquery实现未经美化的简洁TAB菜单效果
- jquery简单实现tab选项卡效果
- jQuery实现的网页右下角tab样式在线客服效果代码