💄 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

@@ -73,7 +73,7 @@
margin-right 0.5em
margin-left 1em
.caption
color color-grey
color froth
display block
font-size 0.9em
margin-top 0.5em
@@ -267,6 +267,8 @@ $article-share-link
background google-color
text-shadow 0 1px darken(google-color, 20%)
.pswp__caption__center
text-align center !important
@import "tocbot"
@import "gallery"

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");