Close
Close all except this
Add a new method in outlook2.js as follows:
{
var alltabs = $('#tabs').tabs('tabs');
var currentTab =$('#tabs').tabs(' getSelected');
var allTabtitle = [];
$.each(alltabs,function(i,n){
allTabtitle.push($(n).panel('options').title) ;
})
switch (action) {
case "refresh":
var iframe = $(currentTab.panel('options').content);
var src = iframe. attr('src');
$('#tabs').tabs('update', {
tab: currentTab,
options: {
content: createFrame(src)
}
})
break;
case "close":
var currtab_title = currentTab.panel('options').title;
$('#tabs').tabs(' close', currtab_title);
break;
case "closeall":
$.each(allTabtitle, function (i, n) {
if (n != onlyOpenTitle){
$ ('#tabs').tabs('close', n);
}
});
break;
case "closeother":
var currtab_title = currentTab.panel(' options').title;
$.each(allTabtitle, function (i, n) {
if (n != currtab_title && n != onlyOpenTitle)
{
$('#tabs' ).tabs('close', n);
}
});
break;
case "closeright":
var tabIndex = $('#tabs').tabs( 'getTabIndex', currentTab);
if (tabIndex == alltabs.length - 1){
alert('Dear, there is nothing behind it^@^!!');
return false;
}
$.each(allTabtitle, function (i, n) {
if (i > tabIndex) {
if (n != onlyOpenTitle){
$('#tabs'). tabs('close', n);
}
}
});
break;
case "closeleft":
var tabIndex = $('#tabs'). tabs('getTabIndex', currentTab);
if (tabIndex == 1) {
alert('Dear, there's someone in front of you, we can't afford to offend him. ^@^!!');
return false;
}
$.each(allTabtitle, function (i, n) {
if (i < tabIndex) {
if ( n != onlyOpenTitle){
$('#tabs').tabs('close', n);
}
}
});
break;
case " exit":
$('#closeMenu').menu('hide');
break;
}
}
Change the tabCloseEven method in js to
$('# mm').menu({
onClick: function (item) {
closeTab(item.id);
}
});
return false;
}
This is OK, the code is much more elegant than before!
When calling refresh and closing the current tab, call closeTab('action') //action can be refresh (refresh) or close (close)
When used in an iframe, do this top.closeTab('action ');
Click here to download the latest Easyui application example