问题
Is there any lightbox implementation that allows using <a href=base64-string"
instead of an actual url?
回答1:
Yes I think you can use Slimbox. It has it's own LinkMapper function. This allows you to return any url you want, based on element you are working on at that moment. This is javascript, so you could do an ajax request or whatever kind of link you want to return.
So yes, you need jQuery for this one, but I think there is a Mootools version as well. Have a look at it.
回答2:
You only tagged javascript, however if you can use jQuery you could use fancybox to achieve this with little work:
$("a[href^='data:image']").each(function(){
$(this).fancybox({
content: $("<img/>").attr("src", this.href)
});
});
Code example on jsfiddle
回答3:
To me works replacing the href
with data-remote
as follow,
<a data-remote="{{ base64string }}" data-gallery="multiimages" data-toggle="lightbox">
<img src="{{ base64string }}" />
</a>
来源:https://stackoverflow.com/questions/5614608/lightbox-using-tags-or-a-href-base64