fix(PublicPage): infinite scrolling last page issue

This commit is contained in:
Matthieu Bessat 2020-08-11 09:13:06 +02:00
parent 922b3caa28
commit c1d2457bff

View file

@ -254,6 +254,7 @@ function renderMosaic(data) {
// 1 - parse all the data // 1 - parse all the data
// 2 - for each // 2 - for each
currentOrganizations = data currentOrganizations = data
page = 0
pageCount = Math.floor(data.length / elementsPerPage) pageCount = Math.floor(data.length / elementsPerPage)
renderPage() renderPage()
if (currentCardContainer !== null) { if (currentCardContainer !== null) {
@ -264,15 +265,12 @@ function renderMosaic(data) {
} }
window.onscroll = () => { window.onscroll = () => {
if (focusPoint != null) { if (focusPoint != null && isVisible(focusPoint) && !rendering) {
//console.log(isVisible(focusPoint)) if (page + 1 < pageCount + 1) {
if (isVisible(focusPoint) && !rendering) {
if ((page + 1) < pageCount) {
page++ page++
renderPage() renderPage()
} }
} }
}
} }
/** /**