Used Easyui friends must know the crazy scholar wrote the background interface bar, as a beginner I dare not judge its good or bad, but it does provide us with a nice framework, as long as it is based on the modification, basically can meet the needs of our development.
Know "crazy scholar" wrote the background interface has been for some time, until yesterday only a good study of a bit. In the process of testing, I found a self-unfriendly place, for example: Only one tab tab, click on the "all else off", followed by a pop-up two prompt box, "there is no ~ ~" and "head of the front no ~ ~". I often use vs as a development tool, and friends using VS will also notice that when only one page is open, right-clicking on "Close All is not available" is grayed out and I feel more humane. So, I try to achieve this function. "Crazy scholar" to add comments, so in the study code is very convenient, here really thanks to "crazy scholar" to do the work. In the "Outlook2.js" This file has a function "tabclose ()", which clearly added a note/* For the tab binding right-click */. I am happy to see here, to achieve my function is in the face.
First, the implementation of "All except off" grayed out is not available.
When you open only one tab tab, the right-click menu "All else off" should be grayed out, so you can prompt the user that there is no other tab in addition to this tab. The implementation of the program is very simple, as long as the number of Open tab tab, if the number is 1, then the "all else off" grayed out is not available on the line.
var // Number of tab tabs if (Tabcount <= 1) { $ (' #mm-tabcloseother '). attr ("Disabled", "disabled"). CSS ({"cursor": "Default", " Opacity ":" 0.4 " }); Else { $ (' #mm-tabcloseother '). Removeattr ("Disabled"). CSS ({"cursor": "Pointer", "opacity": "1" }); }
Description: In Firfox,google,opera browser, the "disabled" attribute does not work, so I added a CSS style, set its transparency to make it gray.
Second, implement the "close all to the right of the current page" grayed out is not available.
When there is no tab on the right side of a tab tab, the Tab tab should be dimmed and unavailable. Program implementation is not difficult, as long as the title of the Last tab tab and the current right-click menu on the Tab tab of the title to compare, if the same, the "right of all the current page closed" dimmed is not available.
varTabs = $ (' #tabs '). Tabs (' tabs ');//Get all tab tabsvarTabcount = Tabs.length;//Number of tab tabsvarLasttab = tabs[tabcount-1];//get the last tab tabvarLasttitle = Lasttab.panel (' Options '). Tab.text ();//title of the Last tab tabvarCurrtab_title = $ (' #mm '). Data ("Currtab");//the title of the Current tab tab if(Lasttitle = =currtab_title) { $(' #mm-tabcloseright '). attr ("Disabled", "disabled"). CSS ({"cursor": "Default", "Opacity": "0.4" }); } Else { $(' #mm-tabcloseright '). Removeattr ("Disabled"). CSS ({"cursor": "Pointer", "opacity": "1" }); }
Third, the implementation of the "left all the current page off" dimmed is not available.
This is the opposite of the second one. Gets the title of the First tab tab and the title of the current tab tab to compare.
var onetab = tabs[0]; // First tab tab var onetitle = Onetab.panel (' Options '). Tab.text (); // Title of the First tab tab if (Onetitle = = currtab_title) { $ (' #mm-tabcloseleft '). attr ("Disabled", "disabled"). CSS ({"Cursor": " Default "," Opacity ":" 0.4 " }); Else { $ (' #mm-tabcloseleft '). Removeattr ("Disabled"). CSS ({"cursor": "Pointer", "opacity": "1" });
Finally, the effect of the implementation is as
The above implementation of the three cases of the effect of gray is not available, when the mouse on the top click, the right menu will disappear, in fact, the solution is also very simple, as long as the corresponding click in the event to rebind the context menu can, here does not give the code.
Via:http://www.cnblogs.com/nianming/archive/2011/07/25/2116146.html
Implement jquery Easyui Right-click menu grayed out effect