Html
<div class="mask"></div>
Js
var maskHeight = jQuery(document).height();
var maskWidth = jQuery(window).width();
jQuery('.mask').css({'width':maskWidth,'height':maskHeight+"px"});
jQuery(".mask").show();
Css
.mask {position:absolute; top:0; width:100%; height:100%; background:#000; opacity:0.5; z-index:888;}