javascript - How to display image with fancybox href attribute -
i trying show image fancybox 1.3 . have managed base64 coding, worked charm. now, want retrieve image through servlet. if put url image src attribute, shows image, if put url href attribute, when click on picture shows this:
http://i.imgur.com/oqxruxc.png
i set response content type correctly. can problem?
here's example display base64 image fancy box
you don't need <a>
tag
<div class="content"> <img src="data:image/gif;base64,/9j/4aaqskzjrgab...." alt="social media" > <img src="data:image/gif;base64,/9j/4aaqskzjrgab...." alt="james bond;" > </div>
jquery
$('.content').on('click', 'img', function (e) { var target= $(this).attr("src"); var imgtitle= $(this).attr("alt"); $.fancybox({ 'overlayshow': true, 'href': target, 'titleposition': 'inside', 'title': imgtitle, }); });
Comments
Post a Comment