【发布时间】:2013-04-20 14:04:27
【问题描述】:
我正在使用带有以下代码的fancybox
$("a[rel=Fancy" + UserId + "].Items").fancybox({ 'autoscale': 'false',
'cyclic': true,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'titlePosition': 'over',
'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
});
$("a[rel=Fancy" + UserId + "].Items:first").click();
它打开了fancybox,但它开始显示第一个索引中的图像。我想在用户点击的图片上启动fancybox...
如何在fancybox中给出索引?
【问题讨论】:
-
如何获得索引?你的点击事件处理程序在哪里?
-
你不需要传递任何
index,fancybox 只会打开你点击的链接的href上设置的目标图像,除非你有一个处理程序来修改这种默认行为。 -
我有同样的问题,因为我在我的移动应用程序中绕过点击事件!
标签: javascript jquery .net indexing fancybox