Text CSS
body { .lock & { overflow: hidden; touch-action: none; overscroll-behavior: none; } .loaded & { } }
When I click on the icon, the code adds the HTML class "lock"
const burgerClick = (e:React.MouseEvent<HTMLDivElement>) => { if (widthWindow && widthWindow < 991.98) { dispatch(changeStateMenuBurgerHeader(!stateMenuBurgerHeader)) document.documentElement.classList.toggle('lock'); } }
I have a component for the hamburger menu. I want to scroll while the menu is active.
I click on the icon and then the hamburger menu is active and I add class "Lock" to the body.
return ( <div className= {!stateMenuBurgerHeader ? "header__burger" : "header__burger menu-open" }> <MyButton className = "header__btn-burger icon-menu" type = "button" > <span></span> </MyButton> <nav className="header__nav nav-header"> <ul className="header__list nav-header__list"> {widthWindow && widthWindow >= 950 ? burgerMenu.map((item) => <LinkBurger burgerMenuList = {item} key = {item.text} className = {item.icon} />) : burgerMenuSecond.map((item) => <LinkBurger burgerMenuList = {item} key = {item.text} className = {item.icon} />) } </ul> </nav> </div> );
Component title menu
<div className="header__cover-lines"> <div className = "header__cover-left-block" onMouseEnter={burgerMouseEnter} onMouseLeave={burgerMouseLeave} onClick = {burgerClick} > <BurgerMenu/> <div className="header__menu-block">CinemaGO</div> </div>
CSS for hamburger menu. But I can't scroll it when mene is active and I don't understand why I tried writing overflow hiding and scrolling it.
.nav-header{ background-color: rgba(21, 21, 21, 0.96); z-index: 4; @media (min-width: $tablet) { padding-bottom: rem(10); padding-top: rem(100); border-radius: rem(10); min-width: rem(400); margin-left: -10px; position: absolute; top: 0; left: 0; transform: translate(0px,-30px); } @media (max-width: $tablet) { position: fixed; top: 0; left: 0; min-width: 100%; min-height: 100%; padding-top: rem(80); transform:translate(-120%,0%); transition: transform ease 1s 0s; overflow: scroll; .menu-open & { transform:translate(0%,0%); transition: transform ease 1s 0s; } }
It worked after I wrote height instead of min-height
Code before change
New Code