Skip to content

Commit

Permalink
feat: add support for inline images
Browse files Browse the repository at this point in the history
  • Loading branch information
ppoffice committed Nov 20, 2017
1 parent 4cceb55 commit 16aff88
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion source/css/_partial/article.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions source/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<span class="caption">' + this.alt + '</span>');
}

// 对于已经包含在链接内的图片不适用lightGallery
if ($(this).parent().prop("tagName") !== 'A') {
$(this).wrap('<a href="' + ($(this).attr("data-imgbig") ? $(this).attr("data-imgbig") : this.src) + '" title="' + this.alt + '" class="gallery-item"></a>');
}
Expand Down

1 comment on commit 16aff88

@ppoffice
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.