We often write effects such as the pop-up box of the mask layer, but the editor recently found that after the pop-up box appears, the background content information it covers can slide, and the experience is very bad, so how to prohibit the background sliding
very simple property
After the popup appears, set the body to hidden
document.body.style.overflow = "hidden";
body is set to auto when the popup is closed
document.body.style.overflow = "hidden";
This can achieve the effect, generally it is dynamically added
to set the overflow property of the body according to your event requirements.