Hi all, if someone could help it would be great.
Im having an issue with a button that has multiple events…
I want the button to be clicked and go to another page and also for it to change an image(this image is on the new page that the button is linked to) when it is clicked at the same time.
How would i go about coding this in wix ?
Here is my code …
import wixLocation from ‘wix-location’
export function button_click(event) {
wixLocation.to (“/blank”)
.then(() => {
$w(“#image1”).hide()
$w(“#image2”).show()
})
}
Please if someone could help that would be amazing.
I have been on this for two days:(.
Kind regards
Sebastian
You may to save state the button was clicked, and checked the state on the next page
with: https://www.wix.com/corvid/reference/wix-storage.html#session
First page
import wixLocation from 'wix-location'
import { session } from 'wix-storage';
export function button_click() {
// Save the button was clicked
session.setItem("buttonClicked", "1");
// Then going to
wixLocation.to("/blank");
}
Blank page
import { session } from 'wix-storage';
$w.onReady(function () {
// Checking is the button was clicked
if (session.getItem("buttonClicked") === "1") {
$w("#image1").hide();
$w("#image2").show();
// clear
session.removeItem("buttonClicked");
}
});
Hi Alexander.
Thanks for the reply. I will Give it a shot and then let you know how it goes with your code ![:slight_smile: :slight_smile:](/images/emoji/google_classic/slight_smile.png?v=12)