forked from M3-Academy/desafio-react-e-typescript
fix(HeaderBotom): Conserta o overflow hidden do menu #9
@ -6,21 +6,21 @@ import styles from "./Header.module.scss";
|
||||
const Header = () => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const resizeWindow = () => {
|
||||
window.addEventListener("resize", () => {
|
||||
if(window.innerWidth > 1024) {
|
||||
document.body.style.overflowY = "auto";
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
resizeWindow();
|
||||
})
|
||||
window.addEventListener("resize", () => {
|
||||
if (window.innerWidth > 1024) {
|
||||
document.body.style.overflowY = "auto";
|
||||
}
|
||||
if (window.innerWidth <= 1024 && isOpen) {
|
||||
document.body.style.overflowY = "hidden";
|
||||
} else {
|
||||
document.body.style.overflowY = "auto";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return (
|
||||
<header id="home" className={styles["header"]}>
|
||||
<header className={styles["header"]}>
|
||||
<HeaderTop isOpen={isOpen} setIsOpen={setIsOpen} />
|
||||
<HeaderBottom isOpen={isOpen} setIsOpen={setIsOpen} />
|
||||
</header>
|
||||
|
@ -5,6 +5,7 @@
|
||||
background: $black;
|
||||
|
||||
padding: 14px 100px;
|
||||
z-index: 20;
|
||||
|
||||
@include mq($lg, max) {
|
||||
position: absolute;
|
||||
|
Loading…
Reference in New Issue
Block a user