jQuery 使用fancybox打开一个弹出的HTML页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13299297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using fancybox to open a pop up HTML page
提问by Spida
I'm just getting to grips with Fancybox, and have made it work ok opening a larger image from a thumbnail.
我刚刚开始使用 Fancybox,并且已经可以从缩略图打开更大的图像。
Now what I'd like to do, is open a pop up window page (HTML page) from a link within the parent window, so that the popup (child window) get the focus, and the parent page behind greys out until the child is closed again.
现在我想做的是从父窗口中的链接打开一个弹出窗口页面(HTML 页面),以便弹出窗口(子窗口)获得焦点,并且后面的父页面变灰,直到子窗口再次关闭。
It's probably dead simple, like me...hope someone can help?
这可能很简单,就像我一样......希望有人能帮忙吗?
Cheers.
干杯。
回答by Kurt
If I understand you correctly, Fancybox's website has an example: http://fancyapps.com/fancybox/#examples
如果我理解正确的话,Fancybox 的网站有一个例子:http://fancyapps.com/fancybox/#examples
Check out the iframe example. Basically set the href of your <a>
tag to the page you want, and in the Fancybox JS, set type: 'iframe'
(not necessarily required, but if Fancybox fails to correctly identify the type, you can set it manually this way).
查看 iframe 示例。基本上把你的<a>
标签的href设置为你想要的页面,在Fancybox JS中设置type: 'iframe'
(不一定需要,但如果Fancybox无法正确识别类型,你可以通过这种方式手动设置)。
Another example: http://jsfiddle.net/VWsRP/1/
另一个例子:http: //jsfiddle.net/VWsRP/1/