Hi, I need some help with a Corvid-problem I have been stuck with for a while.
I have a Wix Gallery Pro grid containing several images, where each image redirects the website to a new link when clicked. I want the link to be opened in a new tab when being clicked together with the ctrl-key, but when the ctrl-key is up I just want it to open in the same window.
I have tried the following code snippet, but the problem is that the ctrl-key doesn’t seem to get recognized when being pushed down. Also, I don’t know how to redirect to the link in the two different ways.
Does anyone have any tips for me?
$w.onReady(function () {
$w("#gallery1").onItemClicked((event) => {
if (event.ctrlKey) {
console.log("Ctrl down");
wixLocation.to(event.item.link); //Redirect the link with a new tab
} else {
console.log('Ctrl up');
wixLocation.to(event.item.link); //Redirect the link in the same tab
}
})
});