3
我现在只需要帮助完成此任务,显示标题中的prev/next按钮的if语句无法正常工作。Fancybox为标题添加左/右按钮
通过添加额外的左/右按钮标题喜欢这里的示例图像中自定义标准的fancybox:
这是我迄今为止它增加了图像计数。这些按钮可以添加到此,使其更容易风格?
$("a.fancybox").fancybox({
'padding' : 5,
'overlayShow' : true,
'speedIn' : 600,
'speedOut' : 500,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'easingIn' : 'easeOutBack',
'easingOut' : 'easeInBack',
'titlePosition' : 'inside',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
$title = '';
var current = currentIndex + 1;
if(current >= currentArray.length){
$title += '<a href="javascript:;" onclick="$.fancybox.prev();" id="fancybox-prev-btn"></a>';
}
if(current <= currentArray.length){
$title += '<a href="javascript:;" onclick="$.fancybox.next();" id="fancybox-next-btn"></a>';
}
$title += '<span class="fancybox-title">' + title + '<span class="fancybox-title-count">(image ' + (currentIndex + 1) + ' of ' + currentArray.length + ')</span></span><br class="clearBoth"/>';
return $title;
}
});
再次感谢您,我花了很长时间在转圈圈,如果改变声明。 我同意'#'而不是javascript。 –
任何机会可以审查最新版本Fancybox(v2.1.0)? ;) – Kate
@Kate检出[此更新的演示](http://jsfiddle.net/ANLxC/70/):) – Mottie