从缩略图单击(fancybox)显示手动定义的库 [英] Display manually defined gallery from thumbnail click (fancybox)

查看:50
本文介绍了从缩略图单击(fancybox)显示手动定义的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用已包含fancybox的Wordpress主题。一切都工作得很好,光滑,干净,按照预期的方式。
现在有一些我想做的事情,不幸的是我没有它的知识:

I am using a theme for Wordpress that has fancybox already included in it. Everything works fine, smooth and clean, the way it's supposed to. Now there is something I'd like to do, and unfortunately I don't have the knowledge for it:

点击我的第一个缩略图公开的帖子,出现fancybox幻灯片并显示所有缩略图。很酷,但我希望这个幻灯片显示的不仅仅是那些缩略图。可能会在本地托管10或20个文件。

When clicking on the 1st thumbnail of my publicated post, a fancybox slideshow appears and displays all the thumbnails. Cool enough, but I'd like this slideshow to display more than just those thumbnails.. Something like 10 or 20 files maybe, hosted locally.

我相信有一种方法要做到这一点,我在另一个问题上找到了这个代码片段(花哨的盒子 - 如何从单个缩略图显示幻灯片)但是无论我怎么努力都无法使它工作(我可以或多或少地读取代码,但是写它还不是什么东西我可以做!)

I believe there's a way to do this, I found this code fragment on another question ( Fancy box - how to show slideshow from a single thumbnail ) but just couldn't make it work, no matter how hard I tried (I can more or less "read" codes, but writing it is not yet something I can do!)

所以是的,简单地说,我希望我的post1花式框显示X图片,而不是缩略图。而且,能够用X个不同的帖子重复这个技巧,所以我需要找到一个干净的方法去做,而不仅仅是一些结构技巧。我试着在我的帖子的html部分包含上面的代码,但是没有用。

So yeah, to put things simply, I'd like my "post1" fancybox to display X pictures, other than the thumbnails. And also, be able to repeat this trick with X different posts, so I need to find a clean way to do it, not just some structure trick. I tried to include the above code in the html part of my post, but just didn't work.

随意回答!如果您需要更多信息,请告诉我!

Feel free to answer! And let me know if you need more info!

我相信这是我的HTML帖子中有趣的部分:

I believe this is the interesting part of my HTML's post:


推荐答案

在阅读了几个问题,外部链接等等之后,这个是我如何弄清楚我的问题,以及我如何相信它的工作原理:(对不起,如果这听起来很基本,但我只是按照我想要的方式来解释它!新手语言:ON)

After reading several questions, external links and more, this is how I figured out my issue, and how I believe it works: (Sorry if it sounds quite basic, but I'm just gonna explain it the way I would have liked to read it! Newbie language: ON)

由于我的WP主题已经激活了fancybox,因此我无需在我的帖子中使用我的HTML代码调用它。在我的帖子上检查我的源代码时(带有1个缩略图而没有添加代码),我看到生成的代码:

Since fancybox is already activated by my WP theme, there is no need for me to call it in my HTML code on my post. When checking my source code on my post (with 1 thumbnail and no code added), I see this code generated:

<div id="product-slider">
        <div id="product-slides">
                            <div class="item-slide">
    <a href="http://www.prepadem.fr/wp-content/uploads/2012/10/cheetah-picture1.jpg" rel="gallery" class="fancybox">
        <img src="http://www.prepadem.fr/wp-content/uploads/et_temp/cheetah-picture1-43518_298x226.jpg" alt="" width =298 height=226 />     <span class="overlay"></span>
   </a>
</div> <!-- .item-slide -->
                    </div> <!-- #product-slides -->

因此幻灯片的rel值是gallery。现在,我只需要在我的帖子中添加尽可能多的文件,以便幻灯片显示它们,并使用以下代码:

Therefore my "rel" value for the slideshow is "gallery". Now, I just need to add as many files as I wish in my post for the slideshow to display them, with the following code:

<a class="fancybox" rel="gallery" href="image02.jpg"></a>
<a class="fancybox" rel="gallery" href="image03.jpg"></a>
<a class="fancybox" rel="gallery" href="image04.jpg"></a>

就是这样,我可以添加任意数量的照片,但没有一个显示为缩略图!无论如何,感谢Toni和Janis的帮助,如果这个答案对其他人没有帮助,至少我很高兴能按照我想要的方式工作!

And that's it, I can add as many pictures as I wish, whilst none of them are displayed as thumbnails! Anyway, thanks to Toni and Janis for their help, if this answer doesn't help anyone else, at least I'm happy to have this working the way I wanted!

这篇关于从缩略图单击(fancybox)显示手动定义的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆