From c1d2457bff75c40c08c1323f2c0cde16105f2e99 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Tue, 11 Aug 2020 09:13:06 +0200 Subject: [PATCH] fix(PublicPage): infinite scrolling last page issue --- assets/development/scripts/home.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/assets/development/scripts/home.js b/assets/development/scripts/home.js index d39277c..82b6394 100644 --- a/assets/development/scripts/home.js +++ b/assets/development/scripts/home.js @@ -254,6 +254,7 @@ function renderMosaic(data) { // 1 - parse all the data // 2 - for each currentOrganizations = data + page = 0 pageCount = Math.floor(data.length / elementsPerPage) renderPage() if (currentCardContainer !== null) { @@ -264,13 +265,10 @@ function renderMosaic(data) { } window.onscroll = () => { - if (focusPoint != null) { - //console.log(isVisible(focusPoint)) - if (isVisible(focusPoint) && !rendering) { - if ((page + 1) < pageCount) { - page++ - renderPage() - } + if (focusPoint != null && isVisible(focusPoint) && !rendering) { + if (page + 1 < pageCount + 1) { + page++ + renderPage() } } }