版权声明:转自
1 2 3 4 5tabs 右键菜单demo QQ:15129679 6 7 8 9 10 11 12 13 1415 tabs 右键菜单demo QQ:1512967916172018
192131 40 136 1372230232924 欢迎您来到网站信息管理系统 25 我的博客地址:http://www.cnblogs.com/yeminglong/p/3745914.html 26 27
28
1 //删除Tabs 2 function closeTab(menu, type) { 3 var allTabs = $("#tt").tabs('tabs'); 4 var allTabtitle = []; 5 $.each(allTabs, function (i, n) { 6 var opt = $(n).panel('options'); 7 if (opt.closable) 8 allTabtitle.push(opt.title); 9 });10 var curTabTitle = $(menu).data("tabTitle");11 var curTabIndex = $("#tt").tabs("getTabIndex", $("#tt").tabs("getTab", curTabTitle));12 switch (type) {13 case 1:14 $("#tt").tabs("close", curTabIndex);15 return false;16 break;17 case 2:18 for (var i = 0; i < allTabtitle.length; i++) {19 $('#tt').tabs('close', allTabtitle[i]);20 }21 break;22 case 3:23 for (var i = 0; i < allTabtitle.length; i++) {24 if (curTabTitle != allTabtitle[i])25 $('#tt').tabs('close', allTabtitle[i]);26 }27 $('#tt').tabs('select', curTabTitle);28 break;29 case 4:30 for (var i = curTabIndex; i < allTabtitle.length; i++) {31 $('#tt').tabs('close', allTabtitle[i]);32 }33 $('#tt').tabs('select', curTabTitle);34 break;35 case 5:36 for (var i = 0; i < curTabIndex-1; i++) {37 $('#tt').tabs('close', allTabtitle[i]);38 }39 $('#tt').tabs('select', curTabTitle);40 break;41 }42 43 }
1
1 //删除Tabs 2 function closeTab(menu, type) { 3 var allTabs = $("#tt").tabs('tabs'); 4 var allTabtitle = []; 5 $.each(allTabs, function (i, n) { 6 var opt = $(n).panel('options'); 7 if (opt.closable) 8 allTabtitle.push(opt.title); 9 });10 var curTabTitle = $(menu).data("tabTitle");11 var curTabIndex = $("#tt").tabs("getTabIndex", $("#tt").tabs("getTab", curTabTitle));12 switch (type) {13 case 1://关闭当前14 $("#tt").tabs("close", cutTabIndex);15 return false;16 break;17 case 2://全部关闭18 for (var i = 0; i < allTabtitle.length; i++) {19 $('#tt').tabs('close', allTabtitle[i]);20 }21 break;22 case 3://除此之外全部关闭23 for (var i = 0; i < allTabtitle.length; i++) {24 if (curTabTitle != allTabtitle[i])25 $('#tt').tabs('close', allTabtitle[i]);26 }27 $('#tt').tabs('select', curTabTitle);28 break;29 case 4://当前侧面右边30 for (var i = curTabIndex; i < allTabtitle.length; i++) {31 $('#tt').tabs('close', allTabtitle[i]);32 }33 $('#tt').tabs('select', curTabTitle);34 break;35 case 5: //当前侧面左边36 for (var i = 0; i < curTabIndex - 1; i++) {37 $('#tt').tabs('close', allTabtitle[i]);38 }39 $('#tt').tabs('select', curTabTitle);40 break;41 case 6: //刷新42 var panel = $("#tt").tabs("getTab", curTabTitle).panel("refresh");43 break;44 }45 46 }