woocommerce / FlexSlider

An awesome, fully responsive jQuery slider plugin
http://www.woocommerce.com/flexslider/
GNU General Public License v2.0
4.92k stars 1.69k forks source link

Apply Flexslider script after some content is dynamically loaded? #1715

Closed aolbrechts closed 1 month ago

aolbrechts commented 6 years ago

Hello!

I want to display a carousel of elements on my web site but the contents are dynamically loaded (via JS). Is there a way to load the elements in my html list then only AFTER that Flexslider is applied to it takes the correct dimensions etc.

Depending on the action, I either have 10 or 20 elements to be displayed and currently with what I've done, I have too much blank space in the situation where I only have 10 elements in the carousel.

Thanks for your advice!

dotun-o commented 6 years ago

Sounds like you need to apply the flexslider in an asynchronous callback (AJAX, promise, async/await, etc.) I haven't attempted this, but I don't see any reason it wouldn't work.