Fancybox - 设置下一个/上一个 URL?

发布于 2025-01-03 00:41:44 字数 345 浏览 3 评论 0原文

我有一个画廊,它使用 Fancybox 根据通过 URL 传递的参数在灯箱内加载 iFrame。在普通图库页面上一切正常(因为所有图像都在页面上供 fancybox 加载)。

我的问题是,在网站的另一个部分中,我有一个区域显示添加到多个画廊的最后 3 张图像,单击该区域会以与正常画廊页面相同的方式打开一个精美框,但仅显示下一个/上一个循环浏览这 3 张最新图像,而不是图库中的所有图像。

目前我能想到的唯一解决方案是添加隐藏链接供 fancybox 拾取,但我觉得这可能会变得混乱,希望有更好的方法。

那么,有没有办法设置下一个/上一个 URL? 或者有人已经使用/能想到的解决这个问题的另一种解决方案?

谢谢

I have a gallery which uses Fancybox to load an iFrame inside the lightbox depending on what parameters are passed through the URL. Everything works fine on the normal gallery pages (as all the images are on the page for fancybox to load in).

My problem is that in another section of the site I have an area which shows the last 3 images added to a number of galleries, which when clicked open up a fancybox in the same fashion as the normal gallery pages, but the next/previous only cycles through these 3 latest images, not all the images in the gallery.

The only solution I can think of at the moment would involve adding hidden links for fancybox to pick up, but I feel this could get messy and hopefully there is a nicer way.

So, is there a way of setting the next/previous URL's?
Or another solution to this issue that someone has used/can think of?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

勿忘心安 2025-01-10 00:41:44

对于那些感兴趣的人,我必须使用的“解决方案”是在页面上为页面上的每个画廊输出许多空的锚标记。

所以画廊 1 看起来像这样:

<a href="/foo/large/bar1.jpg" rel="gallery1">
  <img src="/foo/thumbs/bar1.jpg" alt="foo bar" />
</a>
<a href="/foo/large/bar2.jpg" rel="gallery1">
  <img src="/foo/thumbs/bar2.jpg" alt="foo bar" />
</a>
<a href="/foo/large/bar3.jpg" rel="gallery1">
  <img src="/foo/thumbs/bar3.jpg" alt="foo bar" />
</a>
<a href="/foo/large/bar4.jpg" rel="gallery1"></a>
<a href="/foo/large/bar5.jpg" rel="gallery1"></a>
<a href="/foo/large/bar6.jpg" rel="gallery1"></a>
...

它使代码非常混乱(通常在一个页面上有数百个空链接),但页面上没有任何变化,并且它似乎并没有使页面速度减慢太多(如果有的话) ,所以我想只有我会真正关心标记中的空锚点。在我看来,这不是一个理想的解决方案,但它确实有效。

再次强调,如果有人对这个问题有更干净/更好的解决方案,请分享答案,因为我对此非常感兴趣!

For those interested, the "solution" I have had to use is to output numerous empty anchor tags on the page for each gallery on the page.

So gallery 1 looks something like:

<a href="/foo/large/bar1.jpg" rel="gallery1">
  <img src="/foo/thumbs/bar1.jpg" alt="foo bar" />
</a>
<a href="/foo/large/bar2.jpg" rel="gallery1">
  <img src="/foo/thumbs/bar2.jpg" alt="foo bar" />
</a>
<a href="/foo/large/bar3.jpg" rel="gallery1">
  <img src="/foo/thumbs/bar3.jpg" alt="foo bar" />
</a>
<a href="/foo/large/bar4.jpg" rel="gallery1"></a>
<a href="/foo/large/bar5.jpg" rel="gallery1"></a>
<a href="/foo/large/bar6.jpg" rel="gallery1"></a>
...

It makes the code very messy (often on one page there are hundreds of empty links), but nothing changes on the page, and it doesn't seem to slow the page down much (if at all), so I guess it's only me who will really care that much about the empty anchors being there in the markup. IMO it's not an ideal solution, but it works.

Again, if someone has a cleaner/nicer solution to this problem, please do share the answer as I for one would be very interested!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文