简单jquery遮罩层
#brg { width: 100%; height: 100%; background: #333; position: absolute; top: 0; left: 0; filter: alpha(opacity=60); -moz-opacity: 0.6; opacity: 0.6; position: absolute; top: 0; left: 0; display: none; } #showdiv { width: 100%; height: auto; position: absolute; left: 300px; top: 150px; z-index: 330; display: none; } #testdiv { width: 800px; height: auto; margin: 0 0; border: 1px solid #4d4d4d; background: #f2f2f2; } #close { width: 200px; height: 27px; line-height: 27px; font-size: 14px; font-weight: bold; border: 1px solid #4d4d4d; text-align: center; cursor: pointer; margin: 0 auto; background: #333; color: #fff; }
<div id="brg"> </div> <div id="showdiv"> <div id="close"> 关闭 </div> <div id="testdiv"> 要显示的内容 </div> </div>
$(document).ready(function() { var bheight = document.body.clientHeight; $("#btnAdd").click(function() { $("#brg").css("display", "block"); $("#showdiv").css("display", "block"); $("#brg").css("height", document.body.scrollHeight); $("#showdiv").css("top", document.body.scrollTop + 100); }); $("#close").click(function() { $("#brg").css("display", "none"); $("#showdiv").css("display", "none"); }); });
相关推荐
hellowzm 2020-07-19
drdrsky 2020-06-04
XuNeely 2020-04-22
lyg0 2020-03-07
tianzyc 2020-02-17
沈宫新 2020-01-02
impress 2020-01-02
89510194 2019-12-31
wwwxuewen 2019-12-19
hlfsunshine 2013-09-02
lcyangcss 2019-11-10
zhangpan 2019-11-09
liushi 2007-11-13
超哥Blog 2007-09-30
libowenhit 2007-09-27
宿舍 2019-10-21
zyhui 2014-11-13