Better Snap Scroll Behavior

This commit is contained in:
2023-11-09 02:07:11 -03:00
parent 920701b1bb
commit 951d963eb8
3 changed files with 8 additions and 4 deletions

View File

@@ -9,10 +9,14 @@ export class HomeComponent {
constructor() {}
scrollToElement(element: HTMLElement): void {
let block: ScrollLogicalPosition = "start";
if (window.innerWidth < 400) {
block = "end";
}
element.scrollIntoView({
behavior: "smooth",
block: "start",
inline: "start"
block: block,
inline: "nearest"
});
}
}