fix header js
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
// header
|
// header
|
||||||
toggleOpenX('.lang', '.lang__open', '.lang__list', '.lang__content', false);
|
toggleOpenX('.lang', '.lang__open', '.lang__list', '.lang__content', false);
|
||||||
singleToggleOpenX('#pc-menu','.header__menu-block','.header__pc-menu', '.header', 'white');
|
toggleHeader('#pc-menu','.header__menu-block','.header__pc-menu', '.white', 'white');
|
||||||
singleToggleOpenX('#phone-menu','.header__menu-block','.header__phone-menu', '.header', 'white');
|
toggleHeader('#phone-menu','.header__menu-block','.header__phone-menu', '.white', 'white');
|
||||||
// header
|
// header
|
||||||
|
|
||||||
// media
|
// media
|
||||||
@@ -249,15 +249,12 @@ function toggleOpenX(mainElement, buttonElement ,heightElement, contentElement,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function singleToggleOpenX(button, content, blockheight, removeBlock, removeClass) {
|
function toggleHeader(button, content, blockheight, removeBlock, removeClass) {
|
||||||
let thisButton = document.querySelector(button),
|
let thisButton = document.querySelector(button),
|
||||||
thisContent = document.querySelector(content),
|
thisContent = document.querySelector(content),
|
||||||
|
thisRemoveBlock = document.querySelector(removeBlock) || '',
|
||||||
thisBlockheight = document.querySelector(blockheight);
|
thisBlockheight = document.querySelector(blockheight);
|
||||||
|
|
||||||
// if (removeBlock) {
|
|
||||||
// let thisRemoveBlock = ;
|
|
||||||
// }
|
|
||||||
|
|
||||||
thisButton.onclick = function () {
|
thisButton.onclick = function () {
|
||||||
let height = thisBlockheight.clientHeight;
|
let height = thisBlockheight.clientHeight;
|
||||||
|
|
||||||
@@ -266,14 +263,14 @@ function singleToggleOpenX(button, content, blockheight, removeBlock, removeClas
|
|||||||
thisContent.classList .add('open');
|
thisContent.classList .add('open');
|
||||||
|
|
||||||
if (removeBlock) {
|
if (removeBlock) {
|
||||||
document.querySelector(removeBlock).classList.remove(removeClass);
|
thisRemoveBlock.classList.remove(removeClass);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
thisContent.style.height = null;
|
thisContent.style.height = null;
|
||||||
thisContent.classList .remove('open');
|
thisContent.classList .remove('open');
|
||||||
|
|
||||||
if (removeBlock) {
|
if (removeBlock) {
|
||||||
document.querySelector(removeBlock).classList.add(removeClass);
|
thisRemoveBlock.classList.add(removeClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user