Image overlay to new tab window

Hi all. I hope somebody knows a solution so the button on the backside of a Image Overlay bric will open the link in a new window. Best regards, Ronald

Hey @r_botman

I haven’t got the Bric (if you mean this one so I’m making some assumptions here…

But I have put together this script for you (Using the Image with Text bric as a test case, so it should work for your Bric too). It targets the class of the image (or button in your case) and adds a target="_blank" attribute to each one.

You just need to find out what the class is and replace the .custom-bric-img-item class in the script below. It will most likely include multiple classes, so we only target the button in the Bric. If you want help with the classes, can you post an image showing the html please.

Place in your page footer…

const classTarget = document.querySelectorAll('.custom-bric-img-item');
classTarget.forEach(element => {
   element.setAttribute('target', '_blank')

Thanks @Malachiman! Wil try this!

Sweet. Let me know if you need some help. I tested it locally and seems to work. Probably just getting the classes correct.

It works great @Malachiman. Thanks again Pete!

1 Like

Hey @r_botman

That’s great.