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

Basic jquery code to control the number of tabs opened_jquery

WBOY
Release: 2016-05-16 18:18:19
Original
1163 people have browsed it
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
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template