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
// 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()
}
}
}