When people visit my site they have a lightbox that comes up to enter the site. (that works) Then come to the home page. Which has a pic on it. You can click on the pic which will redirect you to the “about page” I would like to know how to combine the two pages together and then have the opening pic display for 5 sec then show the “about page setup”?
I am very new to doing my own site, I have tried to read as much as i could in forums but i am completely confused now. If this has already been solved in a very step by step action, please point me in the right direction. Thank you.
At the moment you land on the home page, then click on the image and move to the about page, I want to put all the information on the 1 page. Just want to smooth down the site (less code, smaller website)
If all you want to do is set your home page to go to another page after a set time, then you can simply do something like this in your pages onReady.
import wixLocation from 'wix-location';
$w.onReady(function () {
setTimeout(() => {
wixLocation.to("/your-page-to-redirect-to-here");
}, 5000); // set in milliseconds //
});
//Change the 5000 to something else if you don't want it happening after 5 seconds.
For something more elaborate, like letting something happen before the page is redirected, then you can look at this previous forum post for more info along with a god code example.
Or a more technical option if you use Wix Router API and the referrer function.
so I got the code in the home page but because I have a lightbox at the start of the website. The counter starts the moment the site loads up. Need counter to start after the lightbox has been clicked “Enter”
So basically you have your Home page which is where your lightbox is for your website viewers to enter your site, which is actually more like your Landing page.
Have your lightbox close button linked to your next page which will actually be your main Home page and on this page, have the setTimeout code so that this page moves onto your About Us page after 10 secs.
sort of, I think. Let me try and explain it a bit better
When going to website. www.dragonnight.com.au
Light box pops up, After they click “enter” light box closes.
Then I would like the the timer to start, which then would move onto the next page
I hope that makes scence now
or should I change the design so
Landing page has a “welcome and warning msg” “Enter” and “exit”
If they click “enter” then it goes to front page with a profile pic
5 sec delay
then the about page shows up
Your initial plan is fine. Remove the automatic trigger for the lightbox in the editor and use this code to open it instead. Obviously use the name of your lightbox and the path of your intended destination page.
I got rid of the lightbox and change it to just a container box
and set up the button on that to do what i wanted to do. I think its working correctly.
so here is the code import wixLocation from ‘wix-location’;
export function button4_click(event) {
//Add your code for this event here:
$w(“#box1”).hide();
$w(“#horizontalMenu1”).show();
$w(“#socialBar1”).show();
$w.onReady( function () {
setTimeout(() => {
wixLocation.to(“/about”);
}, 3000); // set in milliseconds //
});
//Change the 3000 to something else if you don’t want it happening after 3 seconds.
}
It close to what I want but still not quite right, becasue now #horizontalMenu1 doesnt appear all the time. The only reseaon why its hidden on load is so no one can “click” on the menu. They must click on “enter” or “exit”. Is it possible to only disable the menu on the home page when its loaded the first ??
@lee1 I cant remember now, but i most likely put it in the wrong spot, but what I have done now, works a lot faster on loading up and I think i have all the code right and in the right spot.