CMS Nest
Setup
Running code when cms nest is finished adding nested items
Once all nested items are added to the page, the page height will increase. If using GSAP ScrollTrigger, it's helpful to run a ScrollTrigger.refresh() once all items are added so that the start and end positions of the ScrollTrigger are updated.
<script>
window.addEventListener('cmsNestComplete', () => {
console.log('cmsNest has finished adding all elements to the page.');
ScrollTrigger.refresh();
});
</script>
Rerunning CMS Nest Solution
If new items are added to the page through pagination, filtering, or ajax modals, it's helpful to re-run the script so that the new items also get nested lists. We can do so like this.
<script>
cmsNest();
</script>
Last updated