From 16aff88fe9fc90b9bec1de11879cd261d49c450b Mon Sep 17 00:00:00 2001 From: ppoffice Date: Mon, 20 Nov 2017 10:25:19 -0600 Subject: [PATCH] feat: add support for inline images --- source/css/_partial/article.styl | 5 ++++- source/js/main.js | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/css/_partial/article.styl b/source/css/_partial/article.styl index c4eca98..215978a 100644 --- a/source/css/_partial/article.styl +++ b/source/css/_partial/article.styl @@ -79,8 +79,11 @@ img, video max-width: 100% height: auto - display: block margin: auto + vertical-align: text-bottom + video + a img + display: block iframe border: none table diff --git a/source/js/main.js b/source/js/main.js index 6f08ed9..14b3dfc 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -2,12 +2,14 @@ var toTop = ($('#sidebar').height() - $(window).height()) + 60; // Caption $('.article-entry').each(function(i) { - $(this).find('img').each(function() { + $(this).find('img').filter(function (element) { + return $(this).hasClass(''); + }).each(function() { + // add image caption if (this.alt && !(!!$.prototype.justifiedGallery && $(this).parent('.justified-gallery').length)) { $(this).after('' + this.alt + ''); } - // 对于已经包含在链接内的图片不适用lightGallery if ($(this).parent().prop("tagName") !== 'A') { $(this).wrap(''); }