Show closed context menu when right-click tab tab is added
Specific implementation code:
Right-click menu HTML:
<div id= "MM" class= "Easyui-menu" style= "width:150px"; >
<div id= "Mm-tabclose" > Closing </div>
<div id= "Mm-tabcloseall" > All off </div>
< Div id= "Mm-tabcloseother" > All except close </div>
<div class= "menu-sep" ></div>
<div id= " Mm-tabcloseright > The right of the current page all close </div>
<div id= "Mm-tabcloseleft" > The left of the current page all closed </div>
</ Div>
Here is the JS code:
$ (function () {tabclose ();
Tabcloseeven (); function Tabclose () {/* Double-click to close the Tab tab/$ (". Tabs-inner"). DblClick (function () {var subtitle = $ (this). Childre
N ("span"). text ();
$ (' #tabs '). Tabs (' Close ', subtitle); }) $ (". Tabs-inner"). Bind (' ContextMenu ', function (e) {$ (' #mm '). Menu (' show ', {Left:e.pagex, TOP:E.P
Agey,});
var subtitle =$ (this). Children ("span"). text ();
$ (' #mm '). Data ("Currtab", subtitle);
return false;
}); //Bind Right Menu event function Tabcloseeven () {//close current $ (' #mm-tabclose '). Click (function () {var currtab_title = $ (' #mm
'). Data ("Currtab");
$ (' #tabs '). Tabs (' Close ', currtab_title); //All Close $ (' #mm-tabcloseall '). Click (function () {$ ('. Tabs-inner span '). each (function (i,n) {var t = $ (n).
Text ();
$ (' #tabs '). Tabs (' Close ', t);
});
});
Close tab $ (' #mm-tabcloseother ') except the current. Click (function () {var currtab_title = $ (' #mm '). Data ("Currtab"); $ ('. tabs-inNer span '). each (function (i,n) {var t = $ (n). text ();
if (t!=currtab_title) $ (' #tabs '). Tabs (' Close ', t);
});
});
Closes the currently right tab $ (' #mm-tabcloseright '). Click (function () {var nextall = $ ('. tabs-selected '). Nextall ();
if (nextall.length==0) {//msgshow (' system hint ', ' behind no ~ ~ ', ' error ');
Alert (' Behind no ~ ~ ~ ');
return false;
} Nextall.each (function (i,n) {var t=$ (' a:eq (0) span ', $ (n)). text ();
$ (' #tabs '). Tabs (' Close ', t);
});
return false;
});
Closes the currently left Tab $ (' #mm-tabcloseleft '). Click (function () {var prevall = $ ('. tabs-selected '). Prevall ();
if (prevall.length==0) {alert (' End, no Front ~ ~ ');
return false;
} Prevall.each (function (i,n) {var t=$ (' a:eq (0) span ', $ (n)). text ();
$ (' #tabs '). Tabs (' Close ', t);
});
return false;
}); }
The above is a small series for you to bring the tab component for Jquery-easyui to add a simple example of the right menu function of all the content, I hope that we support cloud-Habitat Community ~