H5页面 遮罩层上弹窗滚动时禁止下层页面滚动的处理

css的处理:

html, body {
    height: 100%;
}
body{
    position: relative;
}
/*遮罩层显示时body的样式*/
.notScroll {
    overflow: hidden;
}
/*遮罩层*/
.window_mask {
    position: fixed;
    top: 0 !important;
}
/*弹窗*/
.window_boundingBox {
    position: fixed !important;
    top: 50% !important;
    margin-top: -214px !important;
    z-index: 1001;
    width: 90%;
    left: 5%;
    background-color: rgb(232, 232, 232);
    border-radius: 3px;
    overflow: hidden;
}
/*弹窗中需要滚动的部分*/
.window_boundingBox .window_body {
    overflow: auto;
    webkit-overflow-scrolling: touch;
    line-height: 28px;
    font-size: 16px;
    padding: 5px 10px;
    height: 242px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

js处理:

// 遮罩出来后让body不可滚动
$('body,html').addClass('notScroll');

//----------------------------

// 遮罩去掉之后body 可滚动
$('body,html').removeClass('notScroll');
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值