用jquery实现网页标签(tab)简单滑动切换效果
代码如下:<!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实现网页标签(tab)切换效果</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
function SwapTab(name,title,content,Sub,cur){
$(name+' '+title).mouseover(function(){
$(this).addClass(cur).siblings().removeClass(cur);
$(content+" > "+Sub).eq($(name+' '+title).index(this)).show().siblings().hide();
});
}
$(function(){
new SwapTab(".SwapTab","span",".tab-content","ul","fb");//排行TAB
})
</script>
<style type="text/css">
.tab span{ color:#2064ae;cursor: hand;!important;cursor: pointer}
.hidden{display:none;}.invisible{visibility:hidden;}
</style>
</head>
<body>
<span class="SwapTab tab"><span class="fb">tab1</span> | <span>tab2</span> | <span>tab3</span></span>
<div class="tab-content">
<ul>
tab1内容
</ul>
<ul class="hidden">
tab2内容
</ul>
<ul class="hidden">
tab3内容
</ul>
</div>
</body>
</html>下载附件:
页:
[1]