feat: add support for inline images

This commit is contained in:
ppoffice 2017-11-20 10:25:19 -06:00
parent 4cceb55155
commit 16aff88fe9
2 changed files with 8 additions and 3 deletions

View File

@ -79,8 +79,11 @@
img, video img, video
max-width: 100% max-width: 100%
height: auto height: auto
display: block
margin: auto margin: auto
vertical-align: text-bottom
video
a img
display: block
iframe iframe
border: none border: none
table table

View File

@ -2,12 +2,14 @@
var toTop = ($('#sidebar').height() - $(window).height()) + 60; var toTop = ($('#sidebar').height() - $(window).height()) + 60;
// Caption // Caption
$('.article-entry').each(function(i) { $('.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)) { if (this.alt && !(!!$.prototype.justifiedGallery && $(this).parent('.justified-gallery').length)) {
$(this).after('<span class="caption">' + this.alt + '</span>'); $(this).after('<span class="caption">' + this.alt + '</span>');
} }
// 对于已经包含在链接内的图片不适用lightGallery
if ($(this).parent().prop("tagName") !== 'A') { 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>'); $(this).wrap('<a href="' + ($(this).attr("data-imgbig") ? $(this).attr("data-imgbig") : this.src) + '" title="' + this.alt + '" class="gallery-item"></a>');
} }