From 029c08a4a7688df6ac6727f765b32f00c91814a0 Mon Sep 17 00:00:00 2001 From: FURK4NGG <105324908+FURK4NGG@users.noreply.github.com> Date: Sun, 30 Mar 2025 10:10:41 +0300 Subject: [PATCH] Update 1.js --- JAVASCRIPT/tr/1.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/JAVASCRIPT/tr/1.js b/JAVASCRIPT/tr/1.js index eaef2e6..1cfdac9 100644 --- a/JAVASCRIPT/tr/1.js +++ b/JAVASCRIPT/tr/1.js @@ -251,10 +251,14 @@ window.addEventListener("scroll", () => { /*when the window is reloading or loading*/ window.addEventListener('load', function() { - const targetElement = document.getElementById('container_1'); - targetElement.scrollIntoView(); - const sidebarCheckbox = document.getElementById('sidebar-active'); - if (sidebarCheckbox.checked) {sidebarCheckbox.checked = false;} + setTimeout(() => { + window.scrollTo({ top: 0, behavior: 'smooth' }); + }, 50); + + const sidebarCheckbox = document.getElementById('sidebar-active'); + if (sidebarCheckbox && sidebarCheckbox.checked) { + sidebarCheckbox.checked = false; + } });