WebJul 26, 2024 · Approach: To prevent body scrolling but allow overlay scrolling we have to switch the overflow to be hidden when the overlay is being shown. And while the whole page’s overflow is hidden or the scroll is disabled the overflow in the y-axis of the overlay is enabled and the overflow can be scrolled. We can toggle this overflow of the body from ... WebJun 3, 2024 · body { position: fixed; } If we know the top of the scroll location and add it to our CSS, then the body will not scroll back to the top of the screen, so problem solved. …
HTML Disable Scrolling: How to Improve Your Website’s …
WebJul 19, 2024 · Body-scroll-lock: will cover all 3 steps. Quote compact. Quote compact. Allows one internal scrollable element inside, which may lead to a real production issue one day. WebOct 10, 2016 · Hiding the scrollbar and still keeping the functionality seems to be a hard thing to do on the body-element. But this might be a good enough solution for you: CSS: … plot summary of macbeth
How to Enable scroll for specific div and disable scroll for …
WebMar 2, 2024 · The common methods to disable scrolling in Javascript are: Force scroll the user back to a specific spot or element – window.onscroll = () => window.scroll (0, 0); Hide the overflow (no scrollbars) – document.body.style.overflow = "hidden"; WebOct 10, 2024 · 4. I am trying to disable the background body scroll when a modal pop up window is open. I created the Modal using React portal. The only way I can think of doing this is by giving the body an overflow-y property when the Modal is open, but am unsure how to execute this.. my Modal.js looks like this. export default function Modal ( {open ... WebApr 15, 2016 · When a dialog is opened with the "modal" option, all other elements on the page are hypothetically disabled. Even though those other elements are masked, you can still scroll-through the modal to the body, which is awkward and not expected behavior. This can lead to the user being confused after closing a modal as the page has scrolled … plot summary of mine boy by peter abraham