From d5f6397faf6d978d2996cd6656cf9e9819ae5291 Mon Sep 17 00:00:00 2001 From: Malaber Date: Wed, 19 Mar 2025 16:19:04 +0100 Subject: [PATCH] Scroll always --- js/components/FavoriteBar.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/components/FavoriteBar.js b/js/components/FavoriteBar.js index 21bcd52..3ed05d3 100644 --- a/js/components/FavoriteBar.js +++ b/js/components/FavoriteBar.js @@ -114,13 +114,16 @@ export function FavoriteBar({teams}) { scrollTo.classList.add('scroll-to-highlight'); setTimeout(() => { scrollTo.classList.remove('scroll-to-highlight'); - }, 2000); + }, 1005); window.removeEventListener('scroll', handleScroll); }, 100); }; scrollTo.scrollIntoView({behavior: 'smooth', block: 'center'}); // Smoothly scroll to the target element + // scroll up a tiny amount to reset the scroll event listener if user is already on the element + window.scrollBy(0, 1); + // Add a scroll event listener to start the highlighting after scrolling only window.addEventListener('scroll', handleScroll); };