tomusborne / generateblocks

GenerateBlocks is a small collection of lightweight WordPress blocks that can accomplish nearly anything.
https://generateblocks.com
197 stars 21 forks source link

Accordion.js - refire on ajax loading #1157

Open diggeddy opened 11 months ago

diggeddy commented 11 months ago

More and more users are using accordions within loops and those loops are being ajax loaded. The issue we have our accordion.js ( and probably tabs ) is that the script fires on Load.

This requries hack workaorunds to reload the script after ajax loading. See here for a topic where the user is working with FacetWP:

https://generate.support/topic/filters-breaking-accordion-block/#post-69623

Can we review the script so it can be refired on other events

iansvo commented 11 months ago

I imagine a simple solve here would be setting up the events using delegation instead of on the actual block elements.