页面没有加载到模态对话框div中



我抓挠我的头,为什么一个模态对话框,我已经建立了不加载由'href'属性在锚标记指定的页面。

Javascript:

// let's build an info dialog!
    $( '.infolink' ).each(function() {
        var $page = $(this);
        var url = $page.attr('href');
        var $docviewer = $('<div class="stuffHolder"></div>')
        .dialog({
            open: function() {
                $( '.stuffHolder' ).load(url);
            },
            title: "Additional Information",
            position: { my: "center top", at: "center top", of: "#trbl" },
            show: true, //animates a fade in for the window
            autoOpen: false, //dialogs do not open by default
            width: 600, //sets dialog width
            height: 600, //sets dialog height
            modal: true, //disables everything below the dialog until dialog is closed
            buttons: {
                "Close Document": function() {
                    $(this).dialog("close");
                     }
            }
        });
        $page.click(function() {
            $docviewer.dialog('open');
            return false;
        });
    }); // end info dialog
HTML:

<a href="test.html" class="infolink">Load test page into modal dialog</a>

对话框加载正常,但加载时完全是空的

尝试更改:

open: function() {
            $( '.stuffHolder' ).load(url);
        },

为:

open: function() {
            $docviewer.load(url);
        },

您也可以尝试在打开对话框之前将$docviewer附加到正文中。也许会有帮助。

最新更新