I’m using SA5 to add captions to dynamic lightbox elements that are being loaded via Finsweet Attibutes List Load. I call the resetLightbox
function when new lightbox items are loaded but the captions do not show up on the new items. Also doesn’t work if I call resetLightbox manually in the console. What is the correct way to initialize the captions on new dymanically loaded collection list items?
<script>
window.FinsweetAttributes = window.FinsweetAttributes || [];
window.FinsweetAttributes.push([
'list',
(listInstances) => {
console.log('List Successfully loaded!');
const [listInstance] = listInstances;
listInstance.addHook('render', () => {
window.Webflow && window.Webflow.destroy();
window.Webflow && window.Webflow.ready();
window.Webflow && window.Webflow.require('ix2').init();
window.sa5.Sa5Lightbox.resetLightbox();
document.dispatchEvent(new Event('readystatechange'));
});
},
]);
</script>