Opening a gallery link in new tab

Good day,

I have created a gallery with images, and added links for each of the image to dynamic pages. Now, I want to have a new tab/window opening when an image in the gallery is clicked (to the dynamic pages).
At the moment, when clicking on an image in the gallery, the dynamic page opens in the same window. I understand that I can change this behaviour by setting an elements target property as follows:

$w("#myElement").target = "_blank";

However, I am stuck here, because I can’t seem to find this “target” property of the gallery or the items in the gallery.

Could anyone please help me out here?

Thanks in advance!

When I do the following:

console.log($w("#myGallery").currentItem);

…I can see in the output, that the current gallery item has a property “target” which is set to “_self”.

But when I try to do this:

$w("#myGallery").currentItem.target = "_blank";

… the code editor tells me the following:

This seems a bit contradictory to me. On the other hand there is no mention of the “target” property in the context of galleries in the documentation.

Does anyone have an idea? It would be much appreciated!

TLDR: I just want to have a new tab opening when clicking on an image in the gallery.