angelinapilarinos Posted November 14, 2020 Share Posted November 14, 2020 Site URL: https://www.angelinapilarinos.com/ Hi I have several gallery pages that have clickthrough URLs connected to my smugmug account. When you click on the image I want a new tab to open to my smugmug page. At the moment it is not opening in a new tab. Can someone tell me what code I need to use to make these links open in a new tab? Thank you! Link to comment
Beyondspace Posted November 14, 2020 Share Posted November 14, 2020 23 minutes ago, angelinapilarinos said: Site URL: https://www.angelinapilarinos.com/ Hi I have several gallery pages that have clickthrough URLs connected to my smugmug account. When you click on the image I want a new tab to open to my smugmug page. At the moment it is not opening in a new tab. Can someone tell me what code I need to use to make these links open in a new tab? Thank you! Kindly add this snippet to Settings->Advanced->Code Injection->Header <script> document.addEventListener('DOMContentLoaded', function() { var slides = document.querySelectorAll(".slide [data-click-through-url]") for (var slides of slides) { slides.addEventListener('click', function(e) { var url = this.getAttribute("data-click-through-url"); console.log(url); if (url) { e.preventDefault(); e.stopPropagation(); window.open(url, '_blank'); } }) } }); </script> BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations) 🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
angelinapilarinos Posted November 14, 2020 Author Share Posted November 14, 2020 That worked, thank you so much!! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.