jQuery遮罩层(转)

转自:http://www.cnblogs.com/rhythmK/archive/2009/07/20/1526936.html

 

//创建遮罩层
    function createMask(){
        
var sWidth,sHeight;
        sWidth 
= window.screen.availWidth;
        
//屏幕可用工作区高度: window.screen.availHeight;
        //屏幕可用工作区宽度: window.screen.availWidth;
        //网页正文全文宽:     document.body.scrollWidth;
        //网页正文全文高:     document.body.scrollHeight;
        if(window.screen.availHeight > document.body.scrollHeight){  //当高度少于一屏
            sHeight = window.screen.availHeight;  
        }
else{//当高度大于一屏
            sHeight = document.body.scrollHeight; 
            
            
            $(
"<div id=\"webMask\"></div>").appendTo("body");
            
            $(
"#webMask").css({posotion:"absolute",top:"0px",left:"0px",background:"#777",filter:"Alpha(opacity=60)",opacity:"0.6",width:sWidth+"px",height:sHeight+"px",zIndex:"100"});  
        }

 

 

posted @ 2010-05-07 11:48  边缘凉风  阅读(460)  评论(0编辑  收藏  举报