I am using an external JQuery library called 3D RealFlipbook (from Codecanyon). It works great, but I'm trying now to generalize my solution to get the PDF url from using the 'data-pdf' attribute which is dynamic. However, it seems like the function cannot get the attribute when I click on my button. What am I doing wrong here?
Here's the code:
<button data-pdf=http://example.com/myPdfUrl.pdf" class="flipper">VIEW MAGAZINE</button>
$(".flipper").flipBook({
pdfUrl: $(this).attr("data-pdf"),
lightBox:true
});
If I do the following, the attribute shows up properly:
$(".flipper").click({
alert($(this).attr("data-pdf"))
});
$(".flipper").flipBook({ pdfUrl: $(this).attr(with no other provided details) -thiswill bewindow