jQuery超简单选项卡完整实例
更新时间:2015年09月26日 09:33:59 作者:企鹅
这篇文章主要介绍了jQuery超简单选项卡实现方法,以一个完整实例形式较为详细的分析了jQuery实现选项卡切换功能的相关技巧,非常简单实用,需要的朋友可以参考下
本文实例讲述了jQuery实现的超简单选项卡效果。分享给大家供大家参考。具体如下:
这是一款基于jQuery的选项卡示例,比较实用的一个实例,希望通过本文让大家掌握如何使用jQuery创建一个选项卡标签,这是目前WEB前端设计比较流行的一款功能。
运行效果截图如下:

在线演示地址如下:
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选项卡实战</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">脚本调试器</li>
<li>样式调试器</li>
<li>DOM调试器</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程序设计有所帮助。
相关文章
jQuery progressbar通过Ajax请求实现后台进度实时功能
这篇文章主要介绍了jQuery progressbar通过Ajax请求实现后台进度实时功能,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2016-10-10
jQuery插入节点和移动节点用法示例(insertAfter、insertBefore方法)
这篇文章主要介绍了jQuery插入节点和移动节点的方法,结合实例形式分析了insertAfter和insertBefore方法针对页面元素节点操作的使用技巧,需要的朋友可以参考下2016-09-09
jquery 实现checkbox全选,反选,全不选等功能代码(奇数)
jquery 实现全选,反选,全不选等功能,下面直接以例子进行说明,需要的朋友可以参考下2012-10-10


最新评论