Recently, I've been working on the code in the work, accumulating some common content. Masks, as the name implies, are things that cover the page, and the common use is to wait for the page request to load, to block other actions, to prevent duplication, to wait for the previous operation to complete before removing the mask, and some picture views to use the class effect.
1CL = Common.lightbox = {2ELEMNT:NULL,3Init:function(){4 varHtml,height = ' 100% ', position = ' fixed ';5 if($.browser.msie && ($.browser.version = = "6.0") &&!$.support.style) {6Height = window.screen.availHeight + ' px ';7Position = "Absolute";8 }9 if($.browser.msie) {Tenhtml = ' <div id= ' Lightbox "style=" left:0; Background:rgb (150,150,150); top:0; width:100%; Height: ' + height + '; Filter:alpha (opacity=30); -moz-opacity:0.3; Opacity:0.3;zoom:1; Position: ' + position + '; Z-index:7; ">" One+ ' <iframe src= "" marginwidth= "0" framespacing= "0" marginheight= "0" frameborder= "0" width= "100%" height= "100%" style = "left:0; Background:rgb (255,255,255); top:0; width:100%; Filter:alpha (opacity=0); -moz-opacity:0; Opacity:0;zoom:1; Position:absolute; Z-index:9 "></iframe>" A+ ' </div> '; -}Else { -html = ' <div id= ' Lightbox "style=" left:0; Background:rgb (150,150,150); top:0; width:100%; Height: ' + height + '; Filter:alpha (opacity=30); -moz-opacity:0.3; Opacity:0.3;zoom:1; Position: ' + position + '; Z-index:7; "></div>"; the } - This. Element =$ (HTML). AppendTo (document.body); - This. Count = 0; - }, + -Showfunction(){ + if(! This. Element) This. Init (); A This. Element.show (); at This. Setzindex ("+=2"); - This. Count < 0? This. Count = 1: This. count++; - return This; - }, - -Hidefunction(){ in if( This. Element) { - This. count--; to This. Setzindex ("-=2"); + if( This. count<=0 | | This. Getzindex () <9) - This. Element.hide (); the } * }, $Getzindex:function(){Panax Notoginseng if( This. Element)returnparseint ( This. ELEMENT.CSS ("ZIndex")) | | -1; - }, theSetzindex:function(zIndex) { + if( This. Element) This. ELEMENT.CSS ("ZIndex", ZIndex | | "+=2"); A }, theResetfunction(){ + if( This. Element) { - This. Count = 0; $ This. Setzindex (7); $ This. Element.hide (); -}Else{ - This. Init (); the } - return This;Wuyi } the};
Multi-browser-compatible page masking layer implementation