From 367caea4e96b21817dde78be8e0b69970617102a Mon Sep 17 00:00:00 2001 From: jamesschuler Date: Wed, 31 May 2023 20:42:03 -0700 Subject: [PATCH] Search form tweaks; infinite scroll tweaks --- frontend/src/components/SearchForm.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/SearchForm.vue b/frontend/src/components/SearchForm.vue index 9745fca..f0dbd50 100644 --- a/frontend/src/components/SearchForm.vue +++ b/frontend/src/components/SearchForm.vue @@ -4,7 +4,7 @@ class="p-6 bg-white dark:bg-dark-200 shadow-lg rounded-xl absolute bottom-0 border-2 border-black" >
-
+
{ - // TODO: this seems too sensitive - const endOfPage = window.innerHeight + window.pageYOffset >= document.body.offsetHeight; + const container = document.getElementById("trainers--container"); + if (container) { + const { scrollTop, scrollHeight, clientHeight } = container; - if (endOfPage) { - store.loadNextPage(); + if (scrollTop + clientHeight >= scrollHeight - 5) { + store.loadNextPage(); + } } }, 1000); }