Initialize slider only after event

Hello,

I have a slider inside a hidden div, that I show after clicking on an element, imagine a lightbox but with a slider inside. The thing is, WebFlow initializes all visible slides when the page loads, and I need to initialize this specific slider after my click event.

How can I use the javascript api to achieve this? Can I access the init function outside the object itself?

Thank you

I’d like to know this too.

In my case I’d like the slider to only start auto-playing when it has entered the user’s viewport. In cases where the slides tell a ‘story’ that requires them to be read in a sequence to make sense - very often a reader will scroll down the page and catch the slider half way through and the story makes no sense.

Intercepting webflow API is not really dev-friendly but looking at their code you can get some hacks. For instance, you could force any slider on the current view to redraw itself invoking Webflow.require(“slider”).redraw();

2 Likes