【问题标题】:Fancybox does not work as expectedFancybox 无法按预期工作
【发布时间】:2013-07-10 11:00:32
【问题描述】:

如果我不单击上一个或下一个按钮,Fancybox 可以正常工作,但是当我单击上一个或下一个按钮时,不会加载组图像,只加载我可以单击的图像

我使用 jquery.fancybox-1.3.4.js,这是我调用的脚本

$(document).ready(function() {
  $("a[rel=example_group]").fancybox({
    'transitionIn'  : 'none',
    'transitionOut' : 'none',
    'titlePosition' : 'over',
    'titleFormat'   : function(title, currentArray, currentIndex, currentOpts) {
      return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
    }
  });
});

这是我调用的代码:

<a rel="example_group" href="images/page1-img3.jpg" alt="" /><img alt="" src="images/page1-img3.jpg"/></a>

【问题讨论】:

标签: javascript jquery fancybox


【解决方案1】:

以您的示例为例,我只看到 Fancybox 可以通过您的 a[rel=example_group] 查询找到的一张图片。你的例子完整吗?

如果您查看fancybox's website,该示例包括 3 个锚标记,组中的每张图片一个:

<a rel="example_group" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">
    <img alt="" src="http://farm3.static.flickr.com/2641/4163443812_df0b200930_m.jpg" />
</a>

<a rel="example_group" title="" href="http://farm3.static.flickr.com/2591/4135665747_3091966c91.jpg">
    <img alt="" src="http://farm3.static.flickr.com/2591/4135665747_3091966c91_m.jpg" />
</a>

<a rel="example_group" title="" href="http://farm3.static.flickr.com/2561/4048285842_90b7e9f8d1.jpg">
    <img alt="" src="http://farm3.static.flickr.com/2561/4048285842_90b7e9f8d1_m.jpg" />
</a>

【讨论】:

  • 我像你一样使用,也给我你的例子。但我的问题是当我点击上一个或下一个时,组图像没有加载,只有我可以点击的图像被加载,我使用 jquery.fancybox-1.3.4.js
猜你喜欢
  • 2013-12-23
  • 2014-12-09
  • 2016-01-13
  • 2020-09-21
  • 2011-08-17
  • 2012-04-29
  • 2021-08-12
  • 2019-02-04
  • 2014-12-02
相关资源
最近更新 更多