将iframe链接到Lightbox中打开 [英] Linking an iframe to open in Lightbox
问题描述
是否可以使用链接链接到在灯箱或幻灯箱中打开的内容的iFrame?
Is it possible to use a link to link to an iFrame of content that opens in a lightbox or fancybox?
EG;查看我的平面设计图库点击这里>灯箱在不同的网站上显示我的图库
EG; View my Graphic Design Gallery Click Here > Lightbox displaying my gallery from a different site
可能吗?我将如何在灯箱/ fancybox中对其进行编码?我知道它现在可能 - 但无法通过我的布局实现它。
Possible? How Would I code it within a lightbox/fancybox? I know it's possible now - but can't get it implemented with my layout.
更新 - 2011年12月17日
我正在努力做到这一点fancybox,下面是我正在开发的布局的链接 - 我已经能够在不同的doc中实现这一点,从头开始调用相同的库/ css,所以它不可能。我觉得它必须是我的一些其他内联JavaScript之间的冲突。任何人都可以帮我弄清楚为什么iFrame花式盒子不能用我的布局实现? (我知道有些JS和代码没有在布局atm中使用,但这只是因为我一直在剥离调试,我将使用所有代码)
I'm trying to do it with fancybox, below is the link of the layout I'm developing - I've been able to implement this in a different doc from scratch calling the same libraries/css in the head, so it can't be that. I feel like it has to be some conflict-ions between some of my other inline JavaScript. Can anyone help me figure out why iFrame fancy box won't implement with my layout? (I know theres some JS and code that isn't be used in the layout atm, but it's just because I've been stripping it down to debug, I will use all that code)
推荐答案
Lightbox仅适用于图像,但您可以使用 fancybox 。
Lightbox is designed only for images but you can use fancybox.
有两种方法可以做到:
$.fancybox({'href':'http://www.google.com',
'type':'iframe'
});
或:
<a href="http://www.google.com" id="linktogoogle">google</a>
jQuery(document).ready(function () {
$("#linktogoogle").fancybox();
});
点击该链接会在iframe中加载google。如果你想加载它而不点击:
Clicking on the link will load google in an iframe. if you want it to load without clicking :
jQuery(document).ready(function () {
$("#linktogoogle").fancybox().click();
});
您还可以将链接可见性样式设置为隐藏。
You may also set the link visibility style to hidden.
这篇关于将iframe链接到Lightbox中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!