在最后一张图片上的Fancybox 2动作
我刚刚更新到Fancybox 2,发现它比以前的版本好多了。
我想知道的是,如果有一种方法在它到达库中的最后一个元素时触发一个函数…现在它循环,但我想回调另一个函数来加载更多的图片!
提前谢谢你,Nicolo’
你可以试试:
$('.fancylink').fancybox({ loop: false, afterShow: function(){ if(this.index == this.group.length - 1){ alert('I am the last item of the gallery'); } } }); // fancybox
它将在画廊的最后一个元素显示后立即显示警告。
对于那些仍然使用旧版本的人:
$("a[rel=group]").fancybox({ onComplete : function(a,index) { var total = $("a[rel=group]").length - 1; if( index == total ){ alert("last one, whats next?"); } } });