401mobileBurger = mobileMenu.querySelector('.t-menuburger');402}403if (mobileBurger) {404var mobileBurgerParent = mobileBurger.parentElement;405var link = document.createElement('a');406link.href = menuMobileBurgerhook;407if (mobileBurgerParent) {408link.appendChild(mobileBurger);409mobileBurgerParent.appendChild(link);410}411}412} else {
const currentMode = document.querySelector('.t-records').getAttribute('data-tilda-mode'); var mobileBurger = mobileMenu.querySelector('.t-menuburger'); mobileMenu.addEventListener('click', function (event) { if (event.target.closest('a')) { return; } if (mobileMenu.classList.contains(mobileMenuOpenClass)) { t_menuBase__FadeOut(menu, 300); mobileMenu.classList.remove(mobileMenuOpenClass); mobileBurger.classList.remove(burgerOpenClass); mobileBurger.classList.remove('t-menu-burger_open'); mobileBurger.setAttribute('aria-expanded', 'false'); if (currentMode === 'edit') { // закрывает бургер-меню в режиме редактирования document.body.classList.remove('t-menu-base_opened'); } } else { t_menuBase__fadeIn(menu, 300, function () { if (menu.style.transform) menu.style.transform = ''; if (menu.style.opacity) menu.style.opacity = ''; }); mobileMenu.classList.add(mobileMenuOpenClass); mobileBurger.classList.add(burgerOpenClass); mobileBurger.classList.add('t-menu-burger_open'); mobileBurger.setAttribute('aria-expanded', 'true'); if (menu.classList.contains('tmenu-mobile__menucontent_fixed')) { var burgerHeight = getComputedStyle(mobileMenu).height; var burgerBorderSize = getComputedStyle(mobileMenu).borderBottom || 0; menu.style.top = burgerHeight + burgerBorderSize; } if (currentMode === 'edit') { // открывает бургер-меню в режиме редактирования document.body.classList.add('t-menu-base_opened'); } } t_menuBase__checkOverflow(recid, selector); }); } } if (screen.width < 960) { rec.addEventListener('click', function (e) { if (!menu || !menu.classList.contains('tmenu-mobile__menucontent_fixed')) return; const menuHeadNode = menu.closest('.r')?.querySelector('.tmenu-mobile_positionfixed'); const menuHeadHeight = menuHeadNode?.offsetHeight || 0; if (menuHeadHeight) menu.style.top = menuHeadHeight + 'px'; // prettier-ignore var menuLink = e.target.closest('.t-menu__link-item, .t978__submenu-link, .t978__innermenu-link, .t966__menu-link, .t-menusub__link-item, .t-btn, .t794__link'); if (!menuLink) return; var submenuClassList = [ 't978__menu-link_hook', 't978__tm-link', 't966__tm-link', 't794__tm-link', 't-menusub__target-link', ]; var isSubmenuHook = submenuClassList.some(function (submenuClass) { return menuLink.classList.contains(submenuClass); }); if (isSubmenuHook) { menu.addEventListener('menuOverflow', function () { t_menuBase__checkOverflow(recid, selector); }); return; } t_menuBase__FadeOut(menu, 300); if (mobileMenu) mobileMenu.classList.remove(mobileMenuOpenClass); if (mobileMenu) mobileBurger.classList.remove(burgerOpenClass); if (mobileMenu) mobileBurger.classList.remove('t-menu-burger_open'); }); } window.addEventListener( 'resize', t_throttle(function () { if (window.innerWidth > 960) { if (menu) menu.style.opacity = ''; if (menu) menu.style.display = ''; if (menu) { const customTopPosition = menu.getAttribute('data-top') || ''; menu.style.top = customTopPosition; } if (mobileMenu) mobileMenu.classList.remove(mobileMenuOpenClass); } t_menuBase__checkOverflow(recid, selector); }, 200) );