On click action

Hi, is it possible to have an action whereby a user clicks a button and this button takes them to ‘x’ page. Then after the page has loaded, my hidden content will show? I am currently using this code:

export function button1_click(event) {
$w(“#container1”).show
}

There are many more containers to add to it but was wondering if this is possible as the button doesn’t take me to the link now that code is added.

Thankyou in advance!

Yes you just set the button to be linked to whatever page you want through the Wix Editor link settings itself or you simply use wix location to function to send the user to the page after they click on the button.
https://www.wix.com/corvid/reference/wix-location.html#to

See here for more info about working with user activity.
https://support.wix.com/en/article/corvid-reacting-to-user-actions-using-events

Then you can simply put the hidden content to be shown when the page is loaded, so you add the show function to the page onReady function.

However, this won’t be practical as if you set it as show for all users, then it will basically be exactly the same as having it shown on your page in the first place.

If you want to have hidden contents only shown to logged in site members, then you will need to check when the page loads if the current user is a logged in member or not.

If they are then the page shows the hidden content and if not then the hidden content stays hidden.

For more info look at Wix Users API and the current user function
https://www.wix.com/corvid/reference/wix-users.html
https://www.wix.com/corvid/reference/wix-users-backend.html

Look at this tutorial for a members profile page, that only shows content to a logged in site member.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area

Finally, you can use Effect Options on your show function, so that you can add a slight delay or effect to your show function.
https://www.wix.com/corvid/reference/$w.EffectOptions.html