Please disable your page from scrolling when you open a Modal window

Most of the web sites uses Modal windows to interact with their users, calling for an action. while the modal window is open, you can still scroll the page under the modal, what happen if your modal are scrollable too? you get a double scroll, one of the most annoying symptom on the web.

Here I’m going to show you a simple way to block the body from keep scrolling when a modal window is open.

ADHD Helpers module

Use the module

Now, in your code, you can use this module like the following example:

ADHDHelpers.disablePageScroll();
...showing a modal window...
...user close the modal...
ADHDHelpers.enablePageScroll();
Show your support

Clapping shows how much you appreciated The Client Side of the Moon’s story.