From ba21a298ff457a242d5f4db8b8710b418c3fb549 Mon Sep 17 00:00:00 2001 From: tamaina Date: Thu, 3 Feb 2022 03:40:12 +0900 Subject: [PATCH] rename --- packages/client/src/scripts/scroll.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/scripts/scroll.ts b/packages/client/src/scripts/scroll.ts index 51c2973ba..3ddcdf64a 100644 --- a/packages/client/src/scripts/scroll.ts +++ b/packages/client/src/scripts/scroll.ts @@ -51,7 +51,7 @@ export function onScrollBottom(el: HTMLElement, cb: Function) { const container = getScrollContainer(el); // とりあえず評価してみる - if (isBottom(el, 1, container)) { + if (isBottomVisible(el, 1, container)) { cb(); return null; } @@ -59,7 +59,7 @@ export function onScrollBottom(el: HTMLElement, cb: Function) { const containerOrWindow = container || window; const onScroll = ev => { if (!document.body.contains(el)) return; - if (isBottom(el, 1, container)) { + if (isBottomVisible(el, 1, container)) { cb(); removeListener(); } @@ -109,7 +109,7 @@ export function isTopVisible(el: HTMLElement, asobi: number = 1): boolean { return scrollTop <= asobi; } -export function isBottom(el: HTMLElement, asobi = 1, container = getScrollContainer(el)) { +export function isBottomVisible(el: HTMLElement, asobi = 1, container = getScrollContainer(el)) { if (container) return el.scrollHeight <= container.clientHeight + Math.abs(container.scrollTop) + asobi; return el.scrollHeight <= window.innerHeight + window.scrollY + asobi; }