Long story short - not able to forbid background from scrolling when it is overlay-ed with drop-down menu. I have tried the solution that has been already suggested in the forum (Disable background scrolling when mobile menu is active (opened)) - but it did not work with the error that webflow.push is not recognized as a function… (same when added in project settings and individually on the page). Overflow-hidden and position-fixed also do not take any action as page has been covered completely with .w-nav-overlay - it draws the height usually way more that the page is - I suppose that is why I cannot stop page from scrolling… Its been already few days and no luck, I would really appreciate a help!
Hey @Filipa, thak you so much for a Sunday reply!
I really enjoyed this article that you suggested, and was quite confident that this time it will work… Unfortunately, after cloning tutorial to my webflow editor, I noticed that when I previewed the content the background was still scrolling… Looks strange, seems that maybe some javascript files are missing in the page description?
I used both scripts (inside script tags). The first script is quite similar to the one on the previous tutorial. The second one (from CSS Tricks) prevents scrolling on mobile devices (at least on iOS… I didn’t test on Android). There’s a problem with the second script though… you won’t be able to scroll on the modal window, even if you set the overflow to auto or scroll. So if you have a lot of content inside the modal, this won’t work very well.
I found another solution that might work for you but I didn’t test it out - Scrollable Overlay
The tutorial was really helpful to understand “how-to”, and after further experimentation appeared that the first code was enough… Interesting thing that after applying it I had a double scroll bar, that worked to hide with this (Preventing body scroll for modals in iOS – Ben Frain)
So far seems to be a working solution, though at some point menu links stopped working, and I am not really sure how well it works on mobile…
Tested today again and it works on all browsers (chrome, firefox, microsoft edge) but NOT on Safari… Further investigation showed that apparently Safari is ignoring overflow… Can anyone address this?..
P.S. tried solutions to prevent body scroll on mobile, but Safari ignores that as well…
The page content is wrapped in a 100% height, so the body doesn’t actually have a scrollbar
The overlay background (separate from the page content) does not have a height, so the child overlay-content element takes the height of the parent (body).
Great solution but how do you get the page to not scroll left and right?!
Check out my site below, you can click any of the first three thumbnails under projects to get pop up modal.
–
Test Site : ZeroSix | Christopher Neil
Read Only : //preview./preview/zerosix?utm_medium=preview_link&utm_source=designer&utm_content=zerosix&preview=098665f20f77196d4b28996d2b54c3ee&mode=preview