弹窗后 页面不滚动
/* 投票弹窗 */
.pop,
.pop1 {
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
top: 0;
left: 0;
position: fixed;
display: none;
z-index: 11;
}
.pop-box {
width: 480px;
height: 328px;
background:
border-radius: 8px;
position: fixed;
top: 50%;
left: 50%;
margin-top: -164px;
margin-left: -240px;
box-sizing: border-box;
position: relative;
padding: 27px 30px 24px 30px;
}
<div class="pop">
<div class="pop-box">
//这里面写内容
</div>
</div>
<script>
// 关闭投票弹窗
$(document).on("click", ".close", function (e) {
e.stopPropagation(); //防止冒泡
$(this).parent().parent().parent().css("display", "none");
//恢复body滚动
document.body.style.overflow = "";
//恢复整个网页滚动
document.documentElement.style.overflow = "";
});
// 打开投票弹窗
$(document).on("click", ".place", function (e) {
e.stopPropagation(); //防止冒泡
$(".pop").css("display", "block");
// 打开蒙层时禁止后面的主题有滚动
//禁止body滚动
document.body.style.overflow = "hidden";
//禁止整个网页滚动
document.documentElement.style.overflow = "hidden";
});
</script>