Coding using links in Pro Gallery

Hi there,

In my site (http://roovwix.wixsite.com/xmpiemp) I have a Pro Gallery that updates its content baed on the text the visitor enters in the text input field.

The code I use for that is:

let galleryItems = await Promise.all(dataItems.map(async function (itemData) {
 let purl = await someUniqueURLEngine(itemData["templateName"], itemData["param1"], personalText, itemData["param"], personalText);
 return {
 "src": purl,
 "description": "",
 "title": itemData.title + " (" + personalText + ")"
        };
    }));

    $w("#gallery1").items = galleryItems;

When an image in the gallery is clicked, it expands.

I now want to allow the user to get the image in its own tab.

So I added a toggle (Show Images in New Tab) and when it’s clicked, I have the following handler:

export function switch1_change(event, $w) {
 if ($w('#switch1').checked) {
        $w('#gallery1').clickAction = "link";
    } else {
        $w('#gallery1').clickAction = "expand";
    }
}

I tried adapting the pro gallery code to this (for testing purposes):

let galleryItems = await Promise.all(dataItems.map(async function (itemData) {
 let purl = await xmpiePersonalizedImageURL(itemData["templateName"], itemData["param1"], personalText, itemData["param"], personalText);
 return {
 "src": purl,
 "description": "",
 "title": itemData.title + " (" + personalText + ")",
 "link": "http://www.apple.com", // for testing. I'll later get the correct URL...
 "target": "_blank"
        };
    }));

    $w("#gallery1").items = galleryItems;

but nothing happens - no new tab, no navigation.

How should I correct my code?

Thanks!

where do you have the click event for galley onclick?

I thought I would not need an onClick for the Pro Gallery, since the gallery has “built-in” link opening as an option…
Am I missing something?