0

https://151megapixel.co.nz/concrete5/index.php/gallery

I have a javascript generated slideshow using SmartPhoto (so I can get the zoom facility). However, I wish to make the data-caption a link through to another page. I cannot post the javascript code here as it is over 1000 lines.

I have tried:

data-link="/concrete5/index.php/purchase"

$(".aclick").click(function (e) {
        e.preventDefault();
        alert($(this).find('data-caption').attr("data-link"));
        });
Robbo
  • 5
  • 5

1 Answers1

0

I checked the link you provided. As I understood, you can write like below:

$('a.js-smartPhoto').click(function (e) {
    e.preventDefault();
    alert($(this).data('link'));
});
hco
  • 655
  • 1
  • 5
  • 15
  • Thanks but didn't work. The code that is generated for the caption is ```Jetty T``` – Robbo Oct 28 '20 at 21:05
  • Firstly, I couldn't see any component with class "aclick". I assumed that you want to reach data-link attribute of anchor tags with "js-smartPhoto" class when clicked. And my code is providing it as I tried on your website. If the question is different please update with more details. – hco Oct 28 '20 at 21:15
  • So when you click the caption above the photo in the slideshow, the browser takes you to the purchase form page? Thats the result I am after. I am using Brave browser but that shouldn't make a difference since code is generic. Don't think it is a caching issue. Hmmm. – Robbo Oct 28 '20 at 21:31