feat: scrollToSelector

This commit is contained in:
2023-03-09 02:17:55 +09:00
parent fdef4caa65
commit 7905ddb7bf
2 changed files with 10 additions and 0 deletions
+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',
});
}