开发者

How to display modal window to overlapping the iframe?

开发者 https://www.devze.com 2023-04-09 06:11 出处:网络
Am trying to display a file in a modal window when a button in an iframe is clicked. The iframe is present in a main window and an iframe is also there where we have kept a button to view the file in

Am trying to display a file in a modal window when a button in an iframe is clicked. The iframe is present in a main window and an iframe is also there where we have kept a button to view the file in a modal window.

The modal window is working fine, but it opens in the iframe itself, but i want that to come out of the iframe and get displayed as a modal window.

HTML and Javascript 开发者_StackOverflowfor the view button where the modal window is called in onClick()

<span class="btn" title='hh' onClick="window.parent.showModal('../sales_stock/stockForm.php',1160,600);">Add New Stock Statement</span>

the show modal function is responsible for poping up the modal window.

I want to know what i should do to make the modal window pop out of the iframe.


If your iframe content from the same domain as you page you can subscribe to the click event from the main page and show popup from the main page. You can't overlap iframe borders from inside.

On the main page:

$("#myframe").contents().find("#button-inside-of-iframe").click(function(){
  $('#mypopup').show();
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号