Hi, I am using this script to prevent the body from scrolling when the modal is on. It works also on iOS devices.
The only problem is that I can only apply it to one modal because it’s based on #id, and I can’t use multiple #ids. Since I have many modals I need help to change the script in the part that says:
var _overlay = document.getElementById(‘overlay’);
so it will effect a specific class (for example .overlay or .modal-wrapper)
can anyone help me to tweak the script inside Before tag?
It actually works now. the only problem is when I’m on a touch device and touch outside the modal (the background moves). this doesn’t happen on the desktop.
I think it’s related to the “disable body from scrolling”…maybe the script needs some sort of option that disable also the touch scroll?