Open a Link in same tab / pro gallery

Hey there,

i Just created a pro gallery and linked it with a CMS.
The images a clickable and open the right link. But in a new Tab… I want to open them in the same tab.

I could also solve it through put every single linked image in the gallery, but i need the filter function… Is there anyone who maybe know a solution or have a code for me? :slight_smile:

Best regards
Carina

import wixLocation from 'wix-location'
$w('#gallery').onItemClicked(event => wixLocation.to(event.item.link))

Try this, it sets a trigger that redirects the page to the link set up for the image, hopefully, that overrides the link opening in a new tab

Thank you for your quick answer!

Maybe a stupid question, but do i just need to put it into the code area below the page editor?
I tried it and it’s not working.

The code snippet I provided uses #gallery as the element tag, as I do not know the actual element tag you have for your gallery