简体   繁体   English

花式盒子上的花式盒子

[英]Fancybox on a fancy box

I am trying to figure out a way where I click an image and a fancy box appears with 3 buttons and when I click on any of the buttons, i get a gallery using fancy box. 我试图找出一种方法,当我单击图像时会出现一个带有3个按钮的精美框,当我单击任何一个按钮时,都会使用精美框获得一个图库。 Is that possible? 那可能吗? I want an Fancy box 1:iFrame-->Fancybox 2: One Image gallery 我想要一个花哨的盒子1:iFrame->花哨的盒子2:一个图片库

I read somewhere it is, and the others said its not, everyone is giving different can anyone help? 我在某处阅读,其他人则说不是,每个人都在给予不同的帮助?

If you are using fancybox v2.x, it's as easy as binding fancybox to your box with buttons and your image galleries so, to launch the fancybox with buttons, create a html like 如果您使用的是fancybox v2.x,就像将fancybox绑定到带有按钮和图像库的框一样容易,因此,要启动带有按钮的fancybox,请创建一个类似HTML

<a class="fancybox" href="#buttonsContainer"><img src="images/01t.jpg" alt="" /></a>

..... notice that we are targeting an inline content with id="buttonsContainer" . .....请注意 ,我们正在使用id="buttonsContainer"定位inline内容。 Then the hidden html content can be like 那么隐藏的 html内容可以像

<div style="display: none;">
 <div id="buttonsContainer">
  <a class="fancybox myButton" href="images/01.jpg" data-fancybox-group="gallery01" title="gallery 01">open gallery 01</a>
  <a class="fancybox myButton" href="images/02.jpg" data-fancybox-group="gallery02" title="gallery 02">open gallery 02</a>
  <a class="fancybox myButton" href="images/03.jpg" data-fancybox-group="gallery03" title="gallery 03">open gallery 03</a>
 </div>
 <div>
  <a class="fancybox" href="images/04.jpg" data-fancybox-group="gallery01" title="gallery 01"></a>
  <a class="fancybox" href="images/05.jpg" data-fancybox-group="gallery02" title="gallery 02"></a>
  <a class="fancybox" href="images/06.jpg" data-fancybox-group="gallery03" title="gallery 03"></a>
  <a class="fancybox" href="images/07.jpg" data-fancybox-group="gallery01" title="gallery 01"></a>
  <a class="fancybox" href="images/08.jpg" data-fancybox-group="gallery03" title="gallery 03"></a>
 </div>
</div>

Notice that we have set to sections, one for the buttons ( buttonsContainer ) and one for the galleries. 注意 ,我们已经设置了部分,一个用于按钮( buttonsContainer ),另一个用于画廊。

The custom fancybox script can be as simple as 自定义fancybox脚本可以很简单

$(document).ready(function(){
 $(".fancybox").fancybox();
}); // ready

...which will work for both, the box with buttons and the image galleries. ...这将同时适用于带有按钮的框和图像库。

see WORKING DEMO 参见工作演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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