feat: scrollToSelector
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
/** @deprecated */
|
||||||
export function scrollHardTo(elementId: string): void {
|
export function scrollHardTo(elementId: string): void {
|
||||||
const element = document.getElementById(elementId);
|
const element = document.getElementById(elementId);
|
||||||
if(!element){
|
if(!element){
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export function scrollToSelector(selector: string): void {
|
||||||
|
const element = document.querySelector(selector);
|
||||||
|
if(!element){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
element.scrollIntoView({
|
||||||
|
behavior: 'auto',
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user