💄 add image caption

This commit is contained in:
shenyu
2021-07-01 10:14:42 +08:00
parent a842da9697
commit 3d4a4fcc7e
4 changed files with 18 additions and 3 deletions

View File

@@ -118,6 +118,19 @@
});
})();
// Caption
$(".article-entry").each(function (i) {
$(this)
.find("img")
.each(function () {
if ($(this).parent().is("a")) return;
const { alt } = this;
if (alt) $(this).after('<span class="caption">' + alt + "</span>");
});
});
// Mobile Nav
const $content = $(".content"),
$sidebar = $(".sidebar");