Auto load to another page after delay

I need my landing page that shows an animated logo to automatically transition to the main page after 5 seconds. I’ve seen past posts years ago that requires coding, how do I do this step by step in 2025 because Wix Studio’s interface is now completely different. TIA.

1 Like

here is a basic code required to put on the landing page.

import wixLocation from 'wix-location';

$w.onReady(function () {
    setTimeout(() => {
        wixLocation.to('/main'); // change '/main' to your actual main page slug
    }, 5000); // 5000 milliseconds = 5 seconds
});

2 Likes

Hi Dan, SOLVED! Many thanks for that.

2 Likes

On another note, out-in transition doesn’t work with the redirection. Is there any way or coding that can achieve out-in page transition?

1 Like

you would need to manually trigger the animation.

  • add a container with you logo to the landing page
import wixLocation from 'wix-location';

$w.onReady(function () {
    setTimeout(() => {
        $w('#mainContainer').hide('fade', {duration: 1000})
            .then(() => {
                wixLocation.to('/main'); 
            });
    }, 4000); 
});

3 Likes

Thanks Dan! You’re a genius mate.

To finesse things, is there coding for the redirected page to fade ‘in’ instead of just bang appear? Sorry I feel like I should be paying you for this.

1 Like

Do the same like already shown by Dan using –>

$w(‘#YourElementIdHere’).hide(‘fade’, {duration: 1000})

–> for any element on your page. Set main elements like sections to invisible (hide).

–> then let them appear slowly using the shown technique.

All you have to do on your loading page will be –>

$w.onReady(()=> {
    $w('#mySectionIdHere').show('fade', {delay:100, duration:2000})             
    .then(()=> {console.log('...section faded-in...')});
});

This code will be inserted inside your —> /main ←- page.

Sections are set to hidden. If Section do not accept such function, then you still can achieve your aim, by setting such functionality for each element on page individually. But normaly sections should support it.

3 Likes

The above from @KEYBOARD-WARRIOR should work. Happy to help out the community with little things like this. If you ever need more complex issues solved feel free to reach out.

3 Likes

Thanks heaps KW, you guys are absolute legends!

2 Likes

Thanks again! I’m actually surprised this effect are not simple steps employed by wixE or wixS. Thx to you both, brownie pts collected from the boss.

3 Likes