Populating array with new items
This commit is contained in:
+2
-8
@@ -25,13 +25,7 @@ class LGallery {
|
|||||||
https://www.lightgalleryjs.com/docs/settings/#licenseKey
|
https://www.lightgalleryjs.com/docs/settings/#licenseKey
|
||||||
*/
|
*/
|
||||||
}, params.lgConfig))
|
}, params.lgConfig))
|
||||||
|
this.items = params.items
|
||||||
// repeat the array for testing
|
|
||||||
let items = []
|
|
||||||
for (let i = 0; i < 50; i++) {
|
|
||||||
items = items.concat(params.items)
|
|
||||||
}
|
|
||||||
this.items = items
|
|
||||||
|
|
||||||
let timeout
|
let timeout
|
||||||
window.addEventListener('scroll', () => {
|
window.addEventListener('scroll', () => {
|
||||||
@@ -52,7 +46,7 @@ class LGallery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadMoreItems () {
|
loadMoreItems () {
|
||||||
const numberOfItems = 20
|
const numberOfItems = 100
|
||||||
if (this.index < this.items.length) {
|
if (this.index < this.items.length) {
|
||||||
// Append thumbnails
|
// Append thumbnails
|
||||||
this.items
|
this.items
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<script src="/share/static/lg/lg-zoom.min.js"></script>
|
<script src="/share/static/lg/lg-zoom.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
lgallery.init(<%- JSON.stringify({lgConfig, items, openItem}) %>) // initLightGallery imported from web.js
|
lgallery.init(<%- JSON.stringify({lgConfig, items, openItem}) %>) // initLightGallery imported from web.js
|
||||||
<% if (false && openItem) { %>
|
<% if (openItem) { %>
|
||||||
const openItem = <%- openItem %>
|
const openItem = <%- openItem %>
|
||||||
const thumbs = document.querySelectorAll('#lightgallery a')
|
const thumbs = document.querySelectorAll('#lightgallery a')
|
||||||
if (thumbs.length >= openItem) {
|
if (thumbs.length >= openItem) {
|
||||||
|
|||||||
Reference in New Issue
Block a user