Added support for lazyloading of images (#266)

This commit is contained in:
Alessio Nava 2017-07-18 11:04:55 +02:00 committed by Ruipeng Zhang
parent 968a31ed90
commit 9ed876f49e
1 changed files with 2 additions and 2 deletions

View File

@ -9,13 +9,13 @@
// 对于已经包含在链接内的图片不适用lightGallery // 对于已经包含在链接内的图片不适用lightGallery
if ($(this).parent().prop("tagName") !== 'A') { if ($(this).parent().prop("tagName") !== 'A') {
$(this).wrap('<a href="' + 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>');
} }
}); });
}); });
if (typeof lightGallery != 'undefined') { if (typeof lightGallery != 'undefined') {
var options = { var options = {
selector: '.gallery-item', selector: '.gallery-item'
}; };
$('.article-entry').each(function(i, entry) { $('.article-entry').each(function(i, entry) {
lightGallery(entry, options); lightGallery(entry, options);