Is it possible to show a loader when you open a modal?

Hi! :slightly_smiling_face:

We’re using the wixWindowFrontend.openModal function to open a URL from a different site in our Wix website.

It takes a few seconds for the URL to load, so it would be great to be able to show a loader until that happens.

Here’s a GIF showing what happens when we call the function:
CleanShot 2023-08-09 at 18.30.22

As you can see, a loader appears but that one is from the URL we’re opening. Until that URL is loaded, the user just sees an empty gray modal, which might be confusing.

Thanks in advance for your help! :pray:

I don’t believe so.

That being said, you could potentially use a Lightbox with a multi-state box and a HTML embed.

When an action is performed to open the lightbox, open the lightbox. Set the multi-state box default state to a preloader gif, and pass the HTML embed the URL of the site you want to load.

Then, after a timeout, change the state of the box to the embed.

Hope that helps :slight_smile:

1 Like

Thank you @noahlovell ! :pray: I’ll try that out and share the result.

1 Like