scroll...

This commit is contained in:
tamaina
2023-07-18 04:39:56 +00:00
parent 054ea30955
commit fd44a29f2b
2 changed files with 18 additions and 1 deletions

View File

@@ -83,6 +83,19 @@ export function scroll(el: HTMLElement | null, options: ScrollToOptions | undefi
}
}
/**
* コンテナを指定してscrollByする
* @param el Container element
* @param options ScrollToOptions
*/
export function scrollBy(el: HTMLElement | null, options: ScrollToOptions | undefined) {
if (el == null) {
window.scrollBy(options);
} else {
el.scrollBy(options);
}
}
/**
* Scroll to Top
* @param el Scroll container element