【发布时间】:2020-04-09 00:34:18
【问题描述】:
我正在尝试在 Featherlight Gallery 中添加图像计数。 示例:图片 1 of 6(图片旁边/下方的某处)
$.featherlightGallery.prototype.afterContent = function(){
var object = this.$instance,
target = this.$currentTarget,
parent = target.parent(),
caption = parent.find('.wp-caption-text'),
galParent = target.parents('.gallery-item'),
jetParent = target.parents('.tiled-gallery-item');
$('<div class="count">Image ' + (currentNavigation() + 1)+' of ' + slides().length + '</div>').html(object.find('.featherlight-content'));
if (0 !== galParent.length) {
caption = galParent.find('.wp-caption-text');
} else if (0 !== jetParent.length) {
caption = jetParent.find('.tiled-gallery-caption');
}
object.find('.caption').remove();
if (0 !== caption.length) {
$('<div class="caption">').text(caption.text()).appendTo(object.find('.featherlight-content'));
}
}
它让我返回错误:currentNavigation is not defined
【问题讨论】:
标签: featherlight.js featherlight