From 6435c0a64157729f8f571bb57a3272b8849269a0 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 9 Dec 2024 03:25:16 +0330 Subject: [PATCH] fixed js bug --- .../segments/menu/HomayonMenu/HomayonMenu.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/resources/views/segments/menu/HomayonMenu/HomayonMenu.js b/resources/views/segments/menu/HomayonMenu/HomayonMenu.js index 87dc47b..abb548d 100644 --- a/resources/views/segments/menu/HomayonMenu/HomayonMenu.js +++ b/resources/views/segments/menu/HomayonMenu/HomayonMenu.js @@ -1,12 +1,16 @@ const scrollBreakpoint = window.innerHeight * 0.2; let fixmenu = function () { - if (window.scrollY > scrollBreakpoint){ - document.querySelector('.HomayonMenu').classList.add('fix'); - document.querySelector('.HomayonMenu').querySelector('.homayon-middle').classList.remove('container'); - }else{ - document.querySelector('.HomayonMenu').classList.remove('fix') - document.querySelector('.HomayonMenu').querySelector('.homayon-middle').classList.add('container'); - } + try { + if (window.scrollY > scrollBreakpoint){ + document.querySelector('.HomayonMenu').classList.add('fix'); + document.querySelector('.HomayonMenu').querySelector('.homayon-middle').classList.remove('container'); + }else{ + document.querySelector('.HomayonMenu').classList.remove('fix') + document.querySelector('.HomayonMenu').querySelector('.homayon-middle').classList.add('container'); + } + } catch { + } + } window.addEventListener('scroll',fixmenu);