save
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user