在index.html里面有个addTab(title, url)方法,然后每次创建前获取当前的并删除就可以,具体代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
function
addTab(title, url){
//关闭当前的
var
currTab = $(
'#tabs'
).tabs(
'getSelected'
);
if
(currTab){
$(
'#tabs'
).tabs(
'close'
,currTab.panel(
'options'
).title);
}
if
($(
'#tabs'
).tabs(
'exists'
, title)){
$(
'#tabs'
).tabs(
'select'
, title);
//选中并刷新
var
currTab = $(
'#tabs'
).tabs(
'getSelected'
);
var
url = $(currTab.panel(
'options'
).content).attr(
'src'
);
if
(url != undefined && currTab.panel(
'options'
).title !=
'Home'
) {
$(
'#tabs'
).tabs(
'update'
,{
tab:currTab,
options:{
content:createFrame(url)
}
})
}
}
else
{
var
content = createFrame(url);
$(
'#tabs'
).tabs(
'add'
,{
title:title,
content:content
//,
//closable:true
});
}
tabClose();
}
|