You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
874 B
29 lines
874 B
'use strict';
|
|
|
|
function toggleOpenX(button, content, blockheight) {
|
|
let thisButton = document.querySelector(button),
|
|
thisContent = document.querySelector(content),
|
|
thisBlockheight = document.querySelector(blockheight);
|
|
|
|
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');
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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
|