feat: scrollToSelector

This commit is contained in:
Hide_D committed 2023-03-09 02:17:55 +09:00
1 parent fdef4caa65
commit 7905ddb7bf
2 files changed
+10

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
/** @deprecated */
export function scrollHardTo(elementId: string): void {
const element = document.getElementById(elementId);
if(!element){
+9
View File
@@ -0,0 +1,9 @@
export function scrollToSelector(selector: string): void {
const element = document.querySelector(selector);
if(!element){
return;
}
element.scrollIntoView({
behavior: 'auto',
});
}