问题描述:

I use the afterContent functunality to add captions to a gallery.

<script>

$(document).ready(function(){

$('.all-imgs').featherlightGallery({

filter: ".img-box-img a",

afterContent: function() {

var caption = this.$currentTarget.find('img').attr('data-caption');

this.$instance.find('.caption').remove();

$('<div class="caption">').text(caption).appendTo(this.$instance.find('.featherlight-content'));

},

variant: "featherlight-gallery2",

});

});

</script>

How do I have to escape links in the img elements data-caption attribute so that the browser renders them as links?

My usecase is to add a link to the fullsize image in the gallery.

Thanks

相关阅读:
Top