Skip to content

Commit

Permalink
website: avoid smooth scrolling when navigating from another page to …
Browse files Browse the repository at this point in the history
…the landing page
  • Loading branch information
brillout committed Oct 24, 2024
1 parent 749c7bd commit 080bbd0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/pages/index/+Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ function Page() {
useEffect(() => {
const cl = document.documentElement.classList
const cls = 'scroll-behavior-smooth'
cl.add(cls)
// We use setTimeout() to avoid smooth scrolling when navigating from another page to the landing page
setTimeout(() => {
cl.add(cls)
}, 0)
return () => cl.remove(cls)
})
return (
Expand Down

0 comments on commit 080bbd0

Please sign in to comment.