这篇我们看看标签页是怎么实现的,默认情况下要靠点击切换标签,也可以用鼠标切换标签选项,就是鼠标放在标签上切换。
首先看看引用的资源文件
1.资源文件
<head>
<meta charset="UTF-8" />
<title>Basic Tabs - jQuery EasyUI Demo</title>
<link rel="stylesheet" href="jquery-easyui-1.3.5/themes/default/easyui.css" />
<link rel="stylesheet" href="jquery-easyui-1.3.5/themes/icon.css" />
<link rel="stylesheet" href="jquery-easyui-1.3.5/demo/demo.css" />
<script type="text/javascript" src="jquery-easyui-1.3.5/jquery.min.js"></script>
<script type="text/javascript" src="jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
</head>
这里我们看到还是这几个文件,这里要说一下jquery.easyui.min.js这个文件是包含所有easyui标签功能的,D:\Serious\phpdev\easyui\jquery-easyui-1.3.5\src这个路径下文件诸如jquery.draggable.js,jquery.linkbutton.js这样的js只是包含单一功能的文件,比jquery.easyui.min.js这个要小。
2.html代码
<body>
<h2>Basic Tabs</h2>
<div class="demo-info">
<div class="demo-tip icon-tip"></div>
<div>Click tab strip to swap tab panel content.</div>
</div>
<div style="margin:10px 0;"></div>
<div id="tt" class="easyui-tabs" style="width:700px;height:auto;">
<div title="About" style="padding:10px;">
<p style="font-size:14px;">jQuery EasyUI framework helps you build your web pages easily.</p>
<ul>
<li>easyui is a collection of user-interface plugin based on jQuery.</li>
<li>easyui provides essential functionality for building modem, interactive, javascript applications.</li>
<li>using easyui you don't need to write many javascript code, you usually defines user-interface by writing some HTML markup.</li>
<li>complete framework for HTML5 web page.</li>
<li>easyui save your time and scales while developing your products.</li>
<li>easyui is very easy but powerful.</li>
</ul>
</div>
<div title="My Documnets" style="padding:10px;">
<ul class="easyui-tree" data-options="url:'jquery-easyui-1.3.5/demo/tabs/tree_data1.json',method:'get',animate:true"></ul>
</div>
<div title="Help" data-options="iconCls:'icon-help',closable:true" style="padding:10px;">
This is the help content.
</div>
</div>
<script type="text/javascript">
$(function(){
var tabs = $("#tt").tabs().tabs('tabs');
for(var i=0; i<tabs.length; i++){
tabs[i].panel('options').tab.unbind().bind('mouseenter',{index:i},function(e){
$('#tt').tabs('select',e.data.index);
});
}
})
</script>
</body>
这个tabs功能其实也很简单,就是在一个div中包含几个嵌套的div就可以了。class="easyui-tabs"这个就是最主要的功能了,easyui可以将这个div下面的div都识别为标签选项。注意style="width:700px;height:auto;"这个属性,高度是auto的话标签的高度可以根据内容自动调整,如果设置为style="width:700px;height:300px;"这样固定高度的话高度就固定为300px。
注意第二个标签内容是一个树形结构,并且数据还是从其他的文件中取得的,<ul class="easyui-tree" data-options="url:'jquery-easyui-1.3.5/demo/tabs/tree_data1.json',method:'get',animate:true"></ul>这个的意思是使用get方法从jquery-easyui-1.3.5/demo/tabs/tree_data1.json这个文件中取得数据源。来看看那这个文件是什么样子的。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASEAAAItCAIAAAD5VVuqAAAgAElEQVR4nO2dsW7jSNaF+USKHM1jjGOl+wID54QfQFoLBjaQUhlyMBigBTA2OpEDAY56YGDR6UCLH9vYYIEONtAfUCSryLolFs0r0cXP+AKbKheLMo9Oka7DmxyPx/3hDQCUSP71r39dfRAAEZPgYwCq4GMAutR97GGa5F+/PtlNX+8mSZJMH68+YoDPRd3HHqZuIUnbAcCPy8fQGEB/4GMAurTysYdpkiST316vP1yATwc+BqAL12MAuuBjALrgYwC6uHyM/0ED9AfrFQF0Yb0igC74GIAu+BiALvgYgC74GIAu+BiALvgYgC4X9LHdKk3TdJ29ZPM0TWfZV/PV7bq+xSBbpmm6eG7Tj5Pv0+SYJD/vv1z97YYRckEfe3+e5ZLYrdI0Xe6Cfj1blhoL7Ofb/eQ4fdw/3aIxuAoX9LH351kuid0qTeeb99P23I4cjvT+PEtPX8tdXWPNfvaHt/3hy283SXJz90dz72gMrsQlr8eyZS6J9+dZutrar75kc1tjRePT98Zc0dcPGoPBMZT7inWN7VbWj+/Ps0pjnUBjcCWGcl8RjUGsDNXHDtnSmAdu1+Zc0UPwXPGP+wmPKgFVru5j2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6eZXpnHKxJr5zVmZNuMGrzCfr3blXLo+NjQkfLOJ5Q0ZmZPbTw5a3NUZ3ysP41VN2byL6PbgeTQ8bGh9C9h5Z2b50eYxgJq29p30rJlcZkh5aw9uWln/to+R4tpXrDGfPPDgeTQ8bGhs1mYeefUuuYxv1rdue5YPzp1PyvOyln7ctPO/HXzWUPllnWW/0p5B8Its/faLYdysmpKqOV4FHPo+NhQ+pfo8KxSGBT42KAx7oYr/oMVVMHHhtI/xAo+BqALPjaU/iFW8DEAXfCxofQPsYKPAeiCjw2lf4gVfAxAF3xsKP13yEGX/6G2GpODVoAcdBQE5peNv3q1YLdDP+Sgux4UOejP1n/HHHQ+NtNkyEF79ksOetx0ykHnv2hNk8hB+/br2U4OOvL+Jc7koBvFO/uBHHTjqMlBR4snB/2SzdtfeYdBDrpx1OSgP33/ElIOujYfawc5aN92ctAjxZ2D9t5LkCEHLW0nBz2C/iXIQX928LFBQw46AvCxofQPsYKPAeiCjw2lf4gVfAxAF3wMQBd8DEAXfAxAF3wMQBd8LICHaZIkk99eL/S3gTjAx8J4mCbJ9PHqw4BPBD4WBhqDUPCxMNAYhIKPBfJ0myTIDALAx8LAxyAUfCwMNAah4GNhoDEIBR8L42GaTO6/XOYdgzjAxwJ4mCZJcvtw7WHA5wIfA9AFHwPQBR8D0AUfA9AlHh8DGCb4GIAu+BiALvgYgC5R+ViXnPLr3YR19KBJbD4Wup6Q9YegTVQ+tkdjMDzwMTQGusTmY0E5ZZ4zBRcAH8PHQJfYfEzSzB/3E6dloTHQZiw+FrodoC8i9DFXTvnxV+G6C42BNlH5mJhTfroVhcT/oEGZ2HwMYGhE5WMAAwQfA9Dl/wE4ZSy0DJl66wAAAABJRU5ErkJggg==" alt="" />
这个文件就存放一个json对象,这里不再深究这个树是怎么实现的。
最后一个标签有点特殊,可以关闭,data-options="iconCls:'icon-help',closable:true"这里设置了一个特性可以关闭。
3.js代码
<script type="text/javascript">
$(function(){
var tabs = $("#tt").tabs().tabs('tabs');
for(var i=0; i<tabs.length; i++){
tabs[i].panel('options').tab.unbind().bind('mouseenter',{index:i},function(e){
$('#tt').tabs('select',e.data.index);
});
}
})
</script>
最后看看js标签实现的鼠标放上去切换的动作,首先获取到所有的标签页,然后对每个标签页绑定mouseenter动作,这个动作就是选中当前标签,$('#tt').tabs('select',e.data.index);绑定动作select,第二个参数是当前标签的index。