当前位置: 移动技术网 > IT编程>网页制作>Html5 > 用jquery实现遮罩层

用jquery实现遮罩层

2018年03月17日  | 移动技术网IT编程  | 我要评论

  <p style=" display:none" id="yinying"></p>  
<script type="text/javascript">  
  
function showUnitInfo()  
    {  
     
 var screenWidth = $(window).width();//当前窗口宽度  
 var screenHeight = $(window).height();//当前窗口高度  
         
$("#yinying").css({"display":"","position": "fixed","background": "#000","z-index": "1001","-moz-opacity": "0.5","opacity":".50","filter": "alpha(opacity=50)","width":screenWidth,"height":screenHeight});  
           
}  
  
</script>  

 

 

jquery写的,使用前需要引用类库。

先写一个不不显示的p,当触发事件时,为这个p添加样式,高度=当前窗口高度,宽度=当前窗口宽度。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网