I have two pages on a site where I want to create two separate, different instances of Flexmasonry. But only one the instances is working.
One page has a UL of images, the other a UL of divs with text content. I have the Flexmasonry code in two separate JS files which are built and minified with Gulp into a single main.js file, which is included on both pages. It seems that whichever of the instances comes last in the compiled JS file is the instance that works, and the previous one doesn't.
This is the un-minified fragment from the built main.js file:
document.addEventListener('DOMContentLoaded', function () {
FlexMasonry.init('.js-image-gallery', {
responsive: true,
breakpointCols: {
'min-width: 980px': 4,
'min-width: 768px': 2
},
});
})
document.addEventListener('DOMContentLoaded', function () {
FlexMasonry.init('.js-information-grid', {
responsive: true,
breakpointCols: {
'min-width: 980px': 3,
'min-width: 768px': 2
},
});
})
Here the .js-information-grid works, but the gallery does not. If switched in order, then the other works.
Is this a known issue with Flexmasonry?
Thanks!
I have two pages on a site where I want to create two separate, different instances of Flexmasonry. But only one the instances is working.
One page has a UL of images, the other a UL of divs with text content. I have the Flexmasonry code in two separate JS files which are built and minified with Gulp into a single main.js file, which is included on both pages. It seems that whichever of the instances comes last in the compiled JS file is the instance that works, and the previous one doesn't.
This is the un-minified fragment from the built main.js file:
Here the
.js-information-gridworks, but the gallery does not. If switched in order, then the other works.Is this a known issue with Flexmasonry?
Thanks!