Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
581 views
in Technique[技术] by (71.8m points)

jquery - FancyBox gallery integration

I have a question regarding the integration of FancyBox. I would create a gallery with 10 pictures but only one thumbnail. For example: http://fancyapps.com/fancybox/demo/ The first demonstration shows four images : forest, sea, sunset and Effeil tower. Can I include a single thumbnail, for example a thumbnail of the Eiffel Tower, which on clicked, would display the image of the Eiffel Tower in the lightbox, but also those of the forest, sea and sunset. I tried many things but nothing works properly. If you have any ideas... Many Thanks.

PS: I use the Twitter Bootstrap-1.3 & FancyBox-2

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You need a link to all the images in your gallery regardless they show a thumbnail or not so you may have this html

<a class="fancybox" rel="gallery" href="image01.jpg"><img src="thumbnail01.jpg" alt="" /></a>
<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>

etc. ... in that way, only a single thumbnail is shown and the rest of the links are not visible but functional.

Then a script like this will fire the gallery

$("a.fancybox").fancybox();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...