Skip to content

Commit 3d268c7

Browse files
authored
Update jquery.addtabs.js
1 parent 32b864b commit 3d268c7

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

jquery.addtabs.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,28 @@
113113
if (options.close && $("li", navobj).size() > 0) {
114114
tabitem.append(' <i class="close-tab fa fa-remove"></i>');
115115
}
116-
//创建新TAB的内容
117-
conitem = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
118-
//是否指定TAB内容
119-
if (opts.content) {
120-
conitem.append(opts.content);
121-
} else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
122-
var height = options.iframeHeight;
123-
conitem.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
124-
} else {
125-
$.get(url, function (data) {
126-
conitem.append(data);
127-
});
116+
if (conitem.size() === 0) {
117+
//创建新TAB的内容
118+
conitem = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
119+
//是否指定TAB内容
120+
if (opts.content) {
121+
conitem.append(opts.content);
122+
} else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
123+
var height = options.iframeHeight;
124+
conitem.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
125+
} else {
126+
$.get(url, function (data) {
127+
conitem.append(data);
128+
});
129+
}
130+
tabobj.append(conitem);
128131
}
129132
//加入TABS
130133
if ($('.tabdrop li', navobj).size() > 0) {
131134
$('.tabdrop ul', navobj).append(tabitem);
132135
} else {
133136
navobj.append(tabitem);
134137
}
135-
tabobj.append(conitem);
136138
} else {
137139
//强制刷新iframe
138140
if (options.iframeForceRefresh) {
@@ -223,4 +225,4 @@
223225
}
224226

225227
};
226-
})(jQuery);
228+
})(jQuery);

0 commit comments

Comments
 (0)