amit
amit

Reputation: 11

jquery-ui-dialog from iframe over parent document

i have few previously built pages that use jquery-ui-dialog and works fine. now my requirement was to make a page with a iframe in it. and this iframe is used to display those previously created pages. in this case the dialogs from the iframe appears inside the iframe not over the parent document. how can i make the dialogs appear over the parent document containing the iframe with minimum change?

thanks in advance.

Upvotes: 1

Views: 3716

Answers (2)

crowicked
crowicked

Reputation: 579

Ugh, iframes always seem to cause problems... best to avoid them completely (I understand if this probably wasn't your choice).

The problem is the browser interprets the i-frame as a separate web page. Not sure, but you could try to define your dialog element (the HTML tags) outside the i-frame and try calling the event from the inside. Something like:

<html>
<div id="callme" style="display:none;">
...
your dialogstuff here
...
</div>

<iframe>
<!-- function that calls the dialog event here -->
</iframe>
</html>

It's worth a shot, I guess.

Upvotes: 1

Fenton
Fenton

Reputation: 250882

If your pages are on the same domain, you could call a function in the parent document from the iframe to display the dialog.

For example...

parent.ShowDialog("Hello World");

With a function in the parent that opens up the UI dialog using the supplied text.

Upvotes: 1

Related Questions