Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Is there any lightbox implementation that allows using <a href=base64-string" instead of an actual url?

like image 521
Fredrik L Avatar asked Jan 20 '23 01:01

Fredrik L


2 Answers

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

like image 127
Mark Coleman Avatar answered Jan 31 '23 09:01

Mark Coleman


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.

like image 43
Marnix Avatar answered Jan 31 '23 10:01

Marnix