A simple example of adding the right-click menu function for the Jquery-easyui tab component _jquery

Source: Internet
Author: User

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 ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.