How to create a matte effect yourself under Easyui
- (function () {
- $.extend ($.fn.tabs.methods, {
- //Show Matte
- Loading: function (JQ, msg) {
- return Jq.each (function () {
- var panel = $ (this). Tabs ("getselected");
- if (msg = = undefined) {
- msg = "Loading data, please wait ...";
- }
- $ ("<div class=\" Datagrid-mask\ "></div>"). CSS ({display: "block", width:panel.width (), Height: Panel.height ()}). AppendTo (panel);
- $ ("<div class=\" datagrid-mask-msg\ "></div>"). HTML (msg). AppendTo (panel). CSS ({display: "block" , Left: (Panel.width ()-$ ("div.datagrid-mask-msg", panel). Outerwidth ())/2, Top: (Panel.height ()-$ ("Div.datag Rid-mask-msg ", panel). Outerheight ())/2});
- });
- }
- ,
- //Hide Masks
- Loaded: function (JQ) {
- return Jq.each (function () {
- var panel = $ (this). Tabs ("getselected");
- Panel.find ("div.datagrid-mask-msg"). Remove ();
- Panel.find ("Div.datagrid-mask"). Remove ();
- });
- }
- });
- }) (JQuery);
Another explanation for (function () {}) (JQuery):
(function ($) {...}) (JQuery) is actually an anonymous function, functions (ARG) {...}
This defines an anonymous function with a parameter of ARG
When calling a function, the parentheses and arguments are written after the function, and because of the precedence of the operator, the function itself needs parentheses, namely:
(function (ARG) {...}) (param)
This is equivalent to defining an anonymous function with a parameter of ARG, and calling this anonymous function as a parameter param
and (function ($) {...}) (jquery) is the same, the reason why only use $ in formal parameters is to not conflict with other libraries, so the argument with JQuery
var fn = function ($) {...};
FN (jQuery);
How to use:
Show Matte: $ ("#tabID"). Tabs ("Loading", msg) msg--information to display
Hide Matte: $ ("#tabID"). Tabs ("Loaded")
:
"Go" Extension easyui tab control, add load matte effect