background scrolling when menu is open
Hello, does anybody know, how to stop background scrolling when you open side menu? I've tried overflow-hidden but it does not work unless its on the main body, but then how would I make it work only when menu is open and closed? without it being always being hidden?
2 Replies
generally if you want to stop scrolling in the background layer when a modal or a menu is open , you can try this
if when your menu is open some dom has a specific class - e.g. you can give the body or whatever container needed to have overflow:hidden but the key is using :has on an ancestor ... such as , but often you want to overflow hidden the body while keeping your menu normal - in case its tall or inside a short window.
ok thank you