Помилка рекурсии у pageHeader
функция updateNavBott вызывает переполнение стека если несколько раз произвести ресайз
необходимо отрефакторить, сложно понять что вобше там происходит
function updateNavBott() {
let width = window.innerWidth,
availableSpaceB = bottomBlock.clientWidth,
hamburger = bottomHamburgerBtn.clientWidth,
logoWidth = bottomLogo.clientWidth;
if (width < tabletWidht && bottomLeftBlock) {
let bottomLeftBlockList = Array.from(bottomLeftBlock.children);
moveItemsLeftMenu(bottomLeftBlockList, hidenLinksBL, breaksBottomLeft, bottomLeftBlock.clientWidth);
} else if (bottomLeftBlock) {
let bottomLeftWidth = bottomLeftBlock.clientWidth;
if (bottomLeftWidth + hamburger > (availableSpaceB / 2) - (logoWidth / 2)) {
moveToHamburgerPrepend(
breaksBottomLeft,
bottomLeftBlock.clientWidth,
hidenLinksBL,
bottomLeftBlock.children[bottomLeftBlock.children.length - 1]
);
} else if ((availableSpaceB / 2) - (logoWidth / 2) > breaksBottomLeft[breaksBottomLeft.length - 1] + hamburger) {
getItOutOfAHamburgerAppend(bottomLeftBlock, hidenLinksBL.children[0], breaksBottomLeft);
}
}
if (width < tabletWidht && bottomRightBlock) {
let bottomRightBlockList = Array.from(bottomRightBlock.children);
moveItemsRightMenu(bottomRightBlockList, hidenLinksBR, breaksBottomRight, bottomRightBlock.clientWidth);
} else if (bottomRightBlock) {
let bottomRightWidth = bottomRightBlock.clientWidth;
if (bottomRightWidth > (availableSpaceB / 2) - (logoWidth / 2)) {
moveToHamburgerPrepend(breaksBottomRight, bottomRightBlock.clientWidth, hidenLinksBR, bottomRightBlock.children[0]);
} else if ((availableSpaceB / 2) - (logoWidth / 2) > breaksBottomRight[breaksBottomRight.length - 1]) {
getItOutOfAHamburgerAppend(bottomRightBlock, hidenLinksBR.children[0], breaksBottomRight);
}
}
hidenLinksBL.setAttribute('count', breaksBottomLeft.length);
hidenLinksBR.setAttribute('count', breaksBottomRight.length);
if(
bottomLeftBlock && bottomLeftBlock.clientWidth + hamburger > (availableSpaceB / 2) - (logoWidth / 2) ||
bottomRightBlock && bottomRightBlock.clientWidth > (availableSpaceB / 2) - (logoWidth / 2)
) {
updateNavBott();
}
}
window.addEventListener('resize', updateNav);
window.addEventListener('resize', updateNavBott);
Edited by Pavel Kuzmenko