繁体   English   中英

Fancybox自定义标题不起作用titleFormat函数

[英]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 ">&nbsp;</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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM