Home  >  Article  >  Web Front-end  >  Basic jquery code to control the number of tabs opened_jquery

Basic jquery code to control the number of tabs opened_jquery

WBOY
WBOYOriginal
2016-05-16 18:18:191145browse
Copy code The code is as follows:

var tabcount = $('#tabs').tabs('tabs ').length; Modify the addTab method as: 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('You have opened too many, please Close unused windows! ');
return false;
}

The maximum number allowed to be opened is 5 (excluding the welcome page). Can be modified as needed
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn