I am trying to make a download button for the image you're currently viewing in Fancybox.
I thought it would be a easy thing to do because the url is already stored in the <img>
tag so I thought I could just re-use that for the link.
I even tried to find the <img>
's src
in fancybox and then .append
it to the href
of the link (<a>
tag). I just lack the jQuery skills to get it done.
To fancybox.js
I've added the <a>
tag:
<img class="fancybox-image" src="image.jpeg" alt="" />
<a href="" class="test">Download</a>
I tried to copy-and-paste the image.jpeg
like so but that didn't work:
var href = $('.fancybox-image').attr('href');
$('a.test').attr('href', href );