[英]Fancybox custom title not working titleFormat function
我正在嘗試在我的fancybox燈箱中實現自定義標題,但它似乎並未調用該函數。 我也嘗試過直接從fancybox網站(http://fancybox.net/blog)復制和粘貼示例,這似乎也不起作用,並且想知道是否有人可以幫助我。
我的代碼如下:
function formatTitle(title, currentArray, currentIndex, currentOpts) {
return '<div id="tip7-title"><span><a href="javascript:;" onclick="$.fancybox.close();"><img src="/data/closelabel.gif" /></a></span>' + (title && title.length ? '<b>' + title + '</b>' : '' ) + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + '</div>';
console.log('Custom fancyTitle shown');
}
$('.mosaic-overlay').fancybox({
custom_counterText: 'Image {#index#} of {#count#}',
'titlePosition' : 'inside',
titleFormat: formatTitle
});
使用html:
<li> <!--Circle-->
<div class="mosaic-block circle">
<a title="Custom Title 1" rel="aapGroup" href="<?php bloginfo('template_directory'); ?>/img/webProjects/aapBlog.jpg" class="mosaic-overlay "> </a>
<div class="mosaic-backdrop"><img src="<?php bloginfo('template_directory'); ?>/img/screenshots/AAPBlog.png"/></div>
</div>
</li>
我嘗試實現此目標的頁面是“ Web Projects”位中的www.alivedesign.co.uk,它是第一個方框。
謝謝你的幫助!
原來我正在使用Fancybox 2.1.3,並且該版本不再支持該方法。 我使用/ r / webdesign /解決了解決方案,可以在這里看到...
http://www.reddit.com/r/webdesign/comments/14bl6r/fancybox_custom_title_not_working_titleformat/
感謝肯尼迪國際機場的幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.