本文实例讲述了jquery ui 实现 tab标签功能。分享给大家供大家参考,具体如下: !DOCTYPE htmlhtmlhead titlewww.jb51.net tab切换/title style type="text/css" #tabs{ width:500px; height:500px; margin:0 auto; } .ui-wi
本文实例讲述了jquery ui 实现 tab标签功能。分享给大家供大家参考,具体如下:
<!DOCTYPE html>
<html>
<head>
<title>www.jb51.net tab切换</title>
<style type="text/css">
#tabs{
width:500px;
height:500px;
margin:0 auto;
}
.ui-widget-header{
border:1px solid grey;
background:grey;
color:#fff;
font-weight:bold;
}
</style>
<link rel="stylesheet" href="https://cdn.bootcss.com/jqueryui/1.11.0/jquery-ui.css" rel="external nofollow" media="screen"/>
<script src="http://img.558idc.com/uploadfile/allimg/210405/2359345410-0.jpg"></script>
<script type="text/javascript" src="http://img.558idc.com/uploadfile/allimg/210405/2359341591-1.jpg"></script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tabs-1" rel="external nofollow" >first tab</a></li>
<li><a href="#tabs-2" rel="external nofollow" >second tab</a></li>
</ul>
<div id="tabs-1">
<p>this is the first tab</p>
</div>
<div id="tabs-2">
<p>this is the second tab</p>
</div>
</div>
<script>
$(function(){
$("#tabs").tabs();
});
</script>
</body>
</html>
运行效果:

感兴趣的朋友可以使用在线HTML/CSS/JavaScript代码运行工具:http://tools.jb51.net/code/HtmlJsRun测试上述代码运行效果。
更多关于jQuery相关内容可查看本站专题:《jQuery页面元素操作技巧汇总》、《jQuery常见事件用法与技巧总结》、《jQuery常用插件及用法总结》、《jQuery扩展技巧总结》及《jquery选择器用法总结》
希望本文所述对大家jQuery程序设计有所帮助。
