Using a BUTTON to select the LINK assigned to an IMAGE in a SLIDESHOW

Hi Corvid forum users.

My first post so hoping this excellent community can help.

I have a slideshow for which I have created buttons outside of the slideshow to advance to the next and previous images using the next() and previous() commands. This works fine.

What I need help with is to have a third button that when clicked will execute the link associated with the image in the slideshow and take the user to the relevant page.


Gallery is #gallery1 and the button is #button1

Any assistance is highly appreciated :slight_smile:

Since it’s an item inside a gallery, you’ll have to use:

$w("#gallery1").onItemClicked((event) => {
//code
})

More details:
https://www.wix.com/corvid/reference/$w.Gallery.html#onItemClicked

but if you want to pull the image data, with external button you should do:

$w("#button).onClick((event) => {
let currentItem = $w("#gallery1").currentItem;
})
//Not all galleries support "currentItem"

Thanks.

I tried your code but when I click on button 1 nothing happens. It does not go to the link assigned to the image in the slideshow at that point.

Code below:

$w.onReady( function () {
//TODO: write your page related code here…
});

export function button3_click(event) {
//Add your code for this event here:
$w(“#gallery1”).next();
}

export function button2_click(event) {
//Add your code for this event here:
$w(“#gallery1”).previous();
}

export function button1_click(event) {
let currentItem = $w(“#gallery1”).currentItem;
}

@jonatandor35
Thanks.
I tried your code but when I click on button 1 nothing happens. It does not go to the link assigned to the image in the slideshow at that point.

Code below:

$w.onReady( function () {
//TODO: write your page related code here…
});

export function button3_click(event) {
//Add your code for this event here:
$w(“#gallery1”).next();
}

export function button2_click(event) {
//Add your code for this event here:
$w(“#gallery1”).previous();
}

export function button1_click(event) {
let currentItem = $w(“#gallery1”).currentItem;
}