Home >Web Front-end >JS Tutorial >jquery mask control implementation code_jquery

jquery mask control implementation code_jquery

WBOY
WBOYOriginal
2016-05-16 18:14:101405browse

Style code:

Copy code The code is as follows:

#div_maskContainer
{
display: none;
}
/*Mask style*/
#div_Mask{
z-index:1000;
filter:alpha(opacity=40);
position: absolute;
left:0px;
top:0px;
background-color: #D4D0C8;
}
/*Display information style*/
#div_loading{
width :300px;height: 60px;position: absolute;
border: 1px outset #B4E0F2;
padding-top: 40px;
text-align: center;
background-color: #CCE9F9;
z-index: 10000;
filter:alpha(opacity=100);!important
}


js control code:
Copy code The code is as follows:

/**
Mask information control
Usage:
1. Reference mask.css
2. Reference mask.js
3. Call method
var obj=new MaskControl();
//Show mask prompt information
obj.show("Displayed prompt information");
//Hide mask prompt information
obj.hide();
//Show prompt information , and automatically close after timeOut (1000 represents 1 second)
obj.autoDelayHide=function(html, timeOut)
*/
function MaskControl(){
this .show=function(html){
var loader=$("#div_maskContainer");
if(loader.length==0){
loader=$("
");
$("body") .append(loader);
}
self.loader=loader;
var w=$(window).width();
var h=$(window).height();
var divMask=$("#div_Mask");
divMask.css("top",0).css("left",0).css("width",w).css("height" ,h);
var tipDiv=$("#div_loading");
if(html==undefined)
html="";
tipDiv.html(html);
loader .show();
var x=(w-tipDiv.width())/2;
var y=(h-tipDiv.height())/2;
tipDiv.css("left ",x);
tipDiv.css("top",y);
},
this.hide=function(){
var loader=$("#div_maskContainer");
if(loader.length==0) return ;
loader.remove();
},
this.autoDelayHide=function(html,timeOut){
var loader=$(" #div_maskContainer");
if(loader.length==0) {
this.show(html);
}
else{
var tipDiv=$("#div_loading") ;
tipDiv.html(html);
}
if(timeOut==undefined) timeOut=3000;
window.setTimeout(this.hide,timeOut);
}

}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn