基本jquery的控制tabs打开的数量的代码

复制代码 代码如下:


var tabcount = $('#tabs').tabs('tabs').length;修改addTab 方法为:function addTab(subtitle, url, icon) {
var tabcount = $('#tabs').tabs('tabs').length;
if (tabcount <= 5) {
if (!$('#tabs').tabs('exists', subtitle)) {
$('#tabs').tabs('add', {
title: subtitle,
content: createFrame(url),
closable: true,
icon: icon
});
} else {
$('#tabs').tabs('select', subtitle);
$('#mm-refresh').click();
}
} else {
alert('您打开的太多了,请关闭不用的窗口!');
return false;
}


这样允许打开的最大数量为5个(不包括欢迎页)。可根据需要自行修改

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdxwpy.html