Skip to content

Commit

Permalink
Merge pull request matcornic#51 from SiamKreative/master
Browse files Browse the repository at this point in the history
Do not wrap images that already wrapped in a link. Closes matcornic#42
  • Loading branch information
vjeantet authored Aug 5, 2017
2 parents 2e264e7 + 8c8a2fe commit 9f4c3e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion static/js/hugo-learn.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ var images = $("div#body-inner img").not(".inline");
// Wrap image inside a featherlight (to get a full size view in a popup)
images.wrap(function(){
var image =$(this);
return "<a href='" + image[0].src + "' data-featherlight='image'></a>";
if (!image.parent("a").length) {
return "<a href='" + image[0].src + "' data-featherlight='image'></a>";
}
});

// Change styles, depending on parameters set to the image
Expand Down

0 comments on commit 9f4c3e9

Please sign in to comment.