var MaskUtil = (function(){  
      
    var $mask,$maskMsg;  
      
    var defMsg = '数据导出中,请稍待。。。';  
      
    function init(){  
        if(!$mask){  
            $mask = $("<div class=\"datagrid-mask mymask\"></div>").appendTo("body");  
        }  
        if(!$maskMsg){  
            $maskMsg = $("<div class=\"datagrid-mask-msg mymask\" style=\"height: 36px\">"+defMsg+"</div>")  
                .appendTo("body").css({'font-size':'12px'});  
        }  
          
        $mask.css({width:"100%",height:$(document).height()});  
          
        var scrollTop = $(document.body).scrollTop();  
          
        $maskMsg.css({  
            left:( $(document.body).outerWidth(true) - 190 ) / 2  
            ,top:( ($(window).height() - 45) / 2 ) + scrollTop  
        });   
                  
    }  
      
    return {  
        mask:function(msg){  
            init();  
            $mask.show();  
            $maskMsg.html(msg||defMsg).show();  
        }  
        ,unmask:function(){  
            $mask.hide();  
            $maskMsg.hide();  
        }  
    }  
      
}()); 

用法

MaskUtil.mask(); 

MaskUtil.unmask(); 

 

相关文章:

  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
  • 2021-05-21
  • 2021-11-12
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-01-13
  • 2021-11-20
  • 2022-01-09
  • 2021-09-05
相关资源
相似解决方案