I’m trying to make a loading screen and was wondering if this code would work?

Hi, i coded something to try to make a loading screen, before i test it i wanted to know if i should add anyhing?

$w.onReady(() => {
        waitForLoading();
});

export function button6_onClick() {
        $w('#lightbox1').show();
        waitForLoading();
}

function waitForLoading() {
        setTimeout(() => {
                $w('#lightbox1').hide('FadeOut');
        }, 1500);
}

Lightbox#1 would be the thing i want to display.

This is what you will need…

Put this code into your LIGHTBOX-SECTION.

import wixWindow from 'wix-window';

$w.onReady(function() {waitForLoading()})

function waitForLoading() {
    setTimeout(() => {
        $w('#lightbox1').hide('fade').then(()=>{
            wixWindow.lightbox.close();
        })
    }, 3500);
}

Would that replace all of the code?

@monumentalstudios1
This is just the part to close the LIGHTBOX.
The opening part should be in your page-code-section.

Or your opening-part is AUTO-LOADED (settep-up in the wix-ui to → “auto-load”.
Take a look onto “Lightbox-Options”.