jQuery Fancybox 2 从代码打开 iframe 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17126417/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 18:29:29  来源:igfitidea点击:

Fancybox 2 Open Iframe version from code

jqueryiframefancybox-2

提问by box86rowh

I see this example : http://jsfiddle.net/STgGM/on the FancyApps page, but I need to do similar, but with an iframe! When I replace the image path with a URL it does not do anything, no errors or anything.

我在 FancyApps 页面上看到了这个例子:http: //jsfiddle.net/STgGM/,但我需要做类似的事情,但要使用 iframe!当我用 URL 替换图像路径时,它不会做任何事情,没有错误或任何事情。

$.fancybox.open([
{
    href : 'http://fancyapps.com/fancybox/demo/1_b.jpg',
    title : '1st title'
},
{
    href : 'http://fancyapps.com/fancybox/demo/2_b.jpg',
    title : '2nd title'
}    
], {
    padding : 0   
});

How can I modify this code to do show my url in an iframe.

如何修改此代码以在 iframe 中显示我的 url。

I have also tried this variation:

我也尝试过这种变化:

$.fancybox({
    href: url,
    openEffect: 'none',
    closeEffect: 'none',
    width: 960,
    height: 540
});

Thanks, Jason

谢谢,杰森

回答by darshanags

Try using the 'type' option.

尝试使用“类型”选项。

Example:

例子:

$.fancybox.open({
    padding : 0,
    href:'http://www.gamespot.com',
    type: 'iframe'
});

Fiddle: http://jsfiddle.net/STgGM/1329/

小提琴:http: //jsfiddle.net/STgGM/1329/

Docs: http://fancyapps.com/fancybox/#docs

文档:http: //fancyapps.com/fancybox/#docs