我有一个页面,它使用 fancybox 2.1.4 根据各自的rel
属性显示多个不同的图像库。
我一直在努力获取当前图像标题中显示的每个画廊的图像计数。在通过此 Stack Overflow 帖子复制 JFK 描述的方法后,剩余的脚本将被禁用。
我的代码如下。任何人都可以帮忙吗?
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox({
helpers : {
title: {
type: 'outside'
}
}, // helpers
afterLoad : function() {
this.title = (this.title ? " + this.title + '<br />' : ") + 'Image ' + (this.index + 1) + ' of ' + this.group.length;
}
});
//start fade transition
(function ($, F) {
F.transitions.resizeIn = function() {
var previous = F.previous,
current = F.current,
startPos = previous.wrap.stop(true).position(),
endPos = $.extend({opacity : 1}, current.pos);
startPos.width = previous.wrap.width();
startPos.height = previous.wrap.height();
previous.wrap.stop(true).trigger('onReset').remove();
delete endPos.position;
current.inner.hide();
current.wrap.css(startPos).animate(endPos, {
duration : current.nextSpeed,
easing : current.nextEasing,
step : F.transitions.step,
complete : function() {
F._afterZoomIn();
current.inner.fadeIn();//this rule controls the fadein of the next image
}
});
};
}(jQuery, jQuery.fancybox));
$(".fancybox")
/*.attr('rel', 'gallery')// am commenting this out so each gallery only loops through itself versus into the next gallery*/
.fancybox({
nextMethod : 'resizeIn',
nextSpeed : 200,//this rule controls the white flash action that happens just after an image is advanced
prevMethod : false,
helpers : {
title : {
type : 'outside'
}
}
}); //end fade transition
});
</script>