This commit is contained in:
Kirill Pet
2024-10-05 21:26:00 +03:00
parent 64e0310bb7
commit ba8ac5dea1
10 changed files with 620 additions and 53 deletions

View File

@@ -1,27 +1,29 @@
'use strict';
// lang start
function toggleOpenX(button, content, blockheight) {
let thisButton = document.querySelector(button),
thisContent = document.querySelector(content),
thisBlockheight = document.querySelector(blockheight);
let lang = document.querySelector('.lang');
lang.onclick = function (e) {
let target = e.target
console.log(e);
if (target.classList.contains('lang__open')) {
thisButton.onclick = function () {
let height = thisBlockheight.clientHeight;
if (!thisContent.classList .contains('open')) {
thisContent.style.height = `${height}px`;
thisContent.classList .add('open');
}else{
thisContent.style.height = null;
thisContent.classList .remove('open');
}
}
// let langOpenButton
// let langContent
// let langList
// let height = langList.offsetHeight;
}
// header start
toggleOpenX('#pc-menu','.header__menu-block','.header__pc-menu');
toggleOpenX('#phone-menu','.header__menu-block','.header__phone-menu');
// header end
// lang start
toggleOpenX('.lang__open','.lang__content','.lang__list');
// lang end