mirror of
https://github.com/DerTyp7/dertyp7.github.io.git
synced 2025-10-29 12:52:08 +01:00
Update SectionScroll behavior
This commit is contained in:
@@ -68,7 +68,7 @@ export default function App() {
|
||||
</div>
|
||||
|
||||
<h4>Website under construction 🚧👷</h4>
|
||||
<SectionScroll sections={["about", "skills", "projects"]} />
|
||||
<SectionScroll sections={["", "skills", "projects"]} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,11 +25,7 @@ export default function SectionScroll({ sections }: { sections: string[] }) {
|
||||
if (newIndex < 0) newIndex = sections.length - 1;
|
||||
if (newIndex >= sections.length) newIndex = 0;
|
||||
|
||||
const sectionElement = document.getElementById(sections[newIndex]);
|
||||
if (sectionElement) {
|
||||
sectionElement.scrollIntoView({ behavior: "smooth" });
|
||||
}
|
||||
|
||||
window.location.hash = sections[newIndex];
|
||||
setCurrentSectionIndex(newIndex);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user