function scrollToContent(){ let target = document.querySelector('.block'); target && target.scrollIntoView({ behavior: 'smooth' }); return false; } function scrollToCertificate(){ let target = document.querySelector('.block--certificate'); target && target.scrollIntoView({ behavior: 'smooth' }); return false; }; function scrollToCatalog(){ let target = document.getElementById('target_catalog'); target && target.scrollIntoView({ behavior: 'smooth' }); return false; }; function scrollToDemand(){ let target = document.getElementById('target_demand'); target && target.scrollIntoView({ behavior: 'smooth' }); return false; }; function clickMenu(type){ // elements let lngsElement = document.getElementById('nav_content_lngs'); let menuElement = document.getElementById('nav_content_menu'); if(!lngsElement || !menuElement) return; let lngsIsOpen = lngsElement.classList.contains('headermobile__content--show'); let menuIsOpen = menuElement.classList.contains('headermobile__content--show'); // close all closeElements([lngsElement, menuElement]); if(type === 'lngs' && !lngsIsOpen) showElement(lngsElement); if(type === 'menu' && !menuIsOpen) showElement(menuElement); } function closeElements(elements = []){ elements.forEach(ele => ele.classList.remove('headermobile__content--show')); document.body.classList.remove('no-scroll'); closeLists(); } function showElement(element){ element.classList.add('headermobile__content--show'); document.body.classList.add('no-scroll'); } function clickNode(node){ let item = node.parentElement; let list = item.querySelector('ul'); let classList = list.classList; let isVisible = classList.contains('treemobile--show'); isVisible ? classList.remove('treemobile--show') : classList.add('treemobile--show'); } function closeLists(){ let lists = [...document.querySelectorAll('.treemobile')]; lists.forEach(item => item.classList.remove('treemobile--show')); }