簡體   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