popup弹出层组件滑动页面问题

一、popup弹出层组件滚动页面问题解决
1、再打开popup的时候加入
let scrollTop = window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop<details>
document.body.style.top = (-1 * scrollTop) + 'px'
document.body.style.position = 'fixed'
1、关闭popup的时候加入
let scrollTop = window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop
document.body.style.position = null
document.body.style.top = ''
window.scrollTo(0, scrollTop)
posted @ 2022-04-28 14:31  孙振光  阅读(803)  评论(0)    收藏  举报