Lightbox using tags or <a href=[base64]>

烂漫一生 提交于 2019-12-10 16:36:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!