fix: do not wrap img that already included in a link

This commit is contained in:
ppoffice 2016-10-15 09:44:32 +08:00
parent c67932d390
commit 0019afad22
1 changed files with 4 additions and 2 deletions

View File

@ -7,9 +7,11 @@
$(this).after('<span class="caption">' + this.alt + '</span>');
}
$(this).wrap('<a href="' + this.src + '" title="' + this.alt + '" class="gallery-item"></a>');
// 对于已经包含在链接内的图片不适用lightGallery
if ($(this).parent().prop("tagName") !== 'A') {
$(this).wrap('<a href="' + this.src + '" title="' + this.alt + '" class="gallery-item"></a>');
}
});
});
if (lightGallery) {
var options = {