const hamb = document.querySelector("#hamb");
const navbar = document.querySelector("#navbar");
const popup = document.querySelector("#popup");
const menu = document.querySelector("#menu");
const menuCity = document.querySelector(".menu-city");
const headerPhone = document.querySelector(".header__phone").cloneNode(1);
const socialLinks = document.querySelector(".footer__social_links").cloneNode(1);
const btnBrand = document.querySelector(".btn_brand").cloneNode(1);
const body = document.body;
hamb.addEventListener("click", hambHandler);
function hambHandler(e) {
e.preventDefault();
popup.classList.toggle("open");
hamb.classList.toggle("--openmenu")
navbar.classList.toggle("--openmenu")
body.classList.toggle("noscroll")
renderPopup();
}
function renderPopup() {
const width = window.innerWidth
if (width < 1269){
popup.appendChild(menu);
}
if (width < 991){
popup.appendChild(menuCity);
}
popup.appendChild(headerPhone);
popup.appendChild(socialLinks);
popup.appendChild(btnBrand);
}