Sample code for adding a mask layer to a specified element

  • 2020-03-30 01:21:34
  • OfStack

 
//The mask layer
$j("<div id='shade'></div>").css({ 
position:'absolute', 
top:0, 
left:0, 
backgroundColor:"#808080", 
opacity:0.1, 
zIndex:300 

}).height($j(document).height()).width($j(document).width()).hide().appendTo("#bgCover"); 

BgCover is the id of the target element

Related articles: