diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-07-12 16:14:49 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-07-12 16:14:49 +0900 |
| commit | 5b5b64d2514cf445aa81a6750ac4185f4e7dd8cd (patch) | |
| tree | 500cd4cfbc79c6ed8592fd8721f705026e8aa79e /src/client/scripts/scroll.ts | |
| parent | fix(client): Fix style (diff) | |
| download | sharkey-5b5b64d2514cf445aa81a6750ac4185f4e7dd8cd.tar.gz sharkey-5b5b64d2514cf445aa81a6750ac4185f4e7dd8cd.tar.bz2 sharkey-5b5b64d2514cf445aa81a6750ac4185f4e7dd8cd.zip | |
fix(client): Fix #6532
Diffstat (limited to 'src/client/scripts/scroll.ts')
| -rw-r--r-- | src/client/scripts/scroll.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/client/scripts/scroll.ts b/src/client/scripts/scroll.ts index f32e50cdc7..a915f2e9ef 100644 --- a/src/client/scripts/scroll.ts +++ b/src/client/scripts/scroll.ts @@ -25,3 +25,12 @@ export function onScrollTop(el: Element, cb) { }; container.addEventListener('scroll', onScroll, { passive: true }); } + +export function scroll(el: Element, top: number) { + const container = getScrollContainer(el); + if (container == null) { + window.scroll({ top: top, behavior: 'instant' }); + } else { + container.scrollTop = top; + } +} |