Fix visible content in navbar
This commit is contained in:
		@@ -1,19 +1,23 @@
 | 
				
			|||||||
const burger = document.querySelector(".hamburger")
 | 
					const burger = document.querySelector(".hamburger")
 | 
				
			||||||
const links = document.querySelector(".links")
 | 
					const links = document.querySelector(".links")
 | 
				
			||||||
const body = document.querySelector("body")
 | 
					const body = document.querySelector("body")
 | 
				
			||||||
 | 
					const main = document.querySelector("main")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let shown = false
 | 
					let shown = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
burger.addEventListener("click", (e) => {
 | 
					burger.addEventListener("click", (e) => {
 | 
				
			||||||
  e.preventDefault()
 | 
					  e.preventDefault()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!shown) {
 | 
					  if (!shown) {
 | 
				
			||||||
    links.style.display = "flex"
 | 
					    links.style.display = "flex"
 | 
				
			||||||
    body.classList.add("disable-scroll")
 | 
					    body.classList.add("disable-scroll")
 | 
				
			||||||
    burger.textContent = "x"
 | 
					    burger.textContent = "x"
 | 
				
			||||||
 | 
					    main.style.visibility = "hidden"
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    links.style.display = "none"
 | 
					    links.style.display = "none"
 | 
				
			||||||
    body.classList.remove("disable-scroll")
 | 
					    body.classList.remove("disable-scroll")
 | 
				
			||||||
    burger.textContent = "☰"
 | 
					    burger.textContent = "☰"
 | 
				
			||||||
 | 
					    main.style.visibility = "visible"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  shown = !shown
 | 
					  shown = !shown
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user