繁体   English   中英

jQuery UI对话框中的iframe

[英]Iframe in the jquery UI dialog

我在jquery UI对话框中有一个iframe,将其src设置为doument.ready事件:

    $(document).ready(function() {
     $("#iframe").attr("src", whatever);
     $("#button").click(function() { $("#dialog").dialog(); });
    });

    <div id="dialog">
     <iframe src="" id="iframe"></iframe>
    <div>

当我click over the button dialog open时一切都很好,但the problemloads iframe content everytime when dialog open它都会loads iframe content everytime when dialog open 。我want to stop这种行为,并load the contents only once at document.ready event我该怎么做?

使用另一个隐藏的iframe,然后在对话框打开时,只需将其内容复制到对话框中的iframe中即可。

问题在于,当您关闭对话框时,JqueryUI会破坏该对话框。

这是一个简单的解决方法: https : //stackoverflow.com/a/9128123/477176

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM