将iFrame中的Fancybox扩展到外部

Arm*_*ire 4 javascript iframe jquery lightbox fancybox

我在这里遇到了问题.我在iFrame中有一个fancybox,它正常工作,但我需要它扩展到iFrame之外,这样它就可以填满整个屏幕(我的意思是扩展到它的父级).

有谁知道怎么做?

Mot*_*tie 8

如果页面和iframe位于同一个域中,则可以从iframe内部打开父级中的fancybox窗口.看看演示.

父窗口(包含fancybox脚本,css和iframe)

<iframe src="child-page.htm" height="250" width="500"></iframe>
Run Code Online (Sandbox Code Playgroud)

子页面(包含在父级中调用fancybox的脚本)

$('a').click(function() {
  // target the parent window (same domain only)
  // then call fancybox in the parent
  // You can add any HTML you want inside the fancybox call
  window.parent.$.fancybox('<img src="http://farm5.static.flickr.com/4058/4252054277_f0fa91e026.jpg" height="333" width="500">');
});
Run Code Online (Sandbox Code Playgroud)