柔城

SOSOFT articles

用jquery实现遮罩层

<div style=" display:none" id="yinying"></div>

<script type="text/javascript" src="http://keleyi.com/keleyi/pmedia/jquery/jquery-1.10.2.min.js"></script>

<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写的,使用前需要引用类库。

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

 

posted on 2013-11-30 15:44  柔城  阅读(3897)  评论(0编辑  收藏  举报

导航