简简单单的6行代码实现tab滑动门效果:如下
html代码:
1
2
3
4
5
6
7
8
9
| <div class="tabs">
<!-- 默认第一个tab为激活状态 -->
<h3 class="active"><span>热点新闻</span></h3>
<div id="tab-01">news</div>
<h3><span>娱乐新闻</span></h3>
<div id="tab-02">enteriment</div>
<h3><span>就业形势</span></h3>
<div id="tab-03">jobs</div>
</div> |
CSS代码:
1
2
3
4
5
6
7
8
| * { margin:0; padding:0;}
body { font:12px Verdana, Geneva, sans-serif; color:#404040;}
.tabs { margin:10px 0 0 20px; width:360px; position:relative; overflow:hidden; height:1%; height:140px;}
.tabs h3 { z-index:2; font-size:12px; background:url(pic.gif) no-repeat; width:95px; height:25px; line-height:25px; text-align:center; float:left; margin-right:5px;}
h3.active { background-position:0 -25px; color:#fff;}
#tab-01, #tab-02, #tab-03 { position:absolute; top:24px; left:0; width:338px; padding:10px; height:93px; border:1px solid #ace; z-index:1;}
#tab-02, #tab-03 { display:none;} |
jQuery代码:
1
2
3
4
5
6
7
| $(document).ready(function() {
$('.tabs h3').mouseover(function() {
$('.tabs div').hide();
$(this).siblings('h3').removeClass('active').end()
.addClass('active').next('div').show();
});
}); |
具体效果也可查看:效果查看
呵呵..沙发一个,也在学习JQuery中…
简单实用,搬走,哈哈。
嘿嘿 不错的
jQuery会使一切变得简单.
CSS实现的方法很巧妙!学习一下!
最近我也在学习jQuery,能否加个链接,以后多来向你学习学习~~
简单学上进
zhoubian5.cn
代码很不错~
楼主给我发份源码啊!谢谢了!
我汗,邮箱地址都没,还让我发源代码,自己贴下来就可以了
请问一下,你的摄影相册程序可以在哪里下载,我看好它】