<div style=" display:none" id="yinying"></div>
<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添加样式,高度=当前窗口高度,宽度=当前窗口宽度。