jQuery UI对话框代码帮助

时间:2011-05-15 21:33:07

标签: javascript html jquery-ui

好吧,不要笑,但我的朋友给了我一个jQuery UI代码的修复,然后我在这里要求另一个修复,现在我不知道如何将两者结合起来。我总共n00b所以请帮帮我。我试过了,但一直遇到语法错误?

我需要合并这个(我认为它在标题之后):

beforeClose: function(){   $(this).remove();   }

进入这个:

function openDialog(url) {
    $("<div class='popupDialog'>Loading...</div>")
        .dialog({
            autoOpen: false,
            closeOnEscape: true,
            width: '900',
            height: 'auto',
            modal: true,
            title: 'Bonus Features'
        }).bind('dialogclose', function() {
            jdialog.dialog('destroy');
        }).load(url, function() {
            $(this).dialog("option", "position", ['center', 'center'] ).bind('dialogopen', function() {
                    adjustJQueryDialogOverlay();
                });
                $(this).dialog("open");
        });
}

$(window).resize(function() {
    $(".ui-dialog-content").dialog("option", "position", ['center', 'center']);
});

有人可以帮忙吗?感谢。

1 个答案:

答案 0 :(得分:1)

function openDialog(url) {
    $("<div class='popupDialog'>Loading...</div>")
        .dialog({
            autoOpen: false,
            closeOnEscape: true,
            width: '900',
            height: 'auto',
            modal: true,
            title: 'Bonus Features', //don't forget the comma
            beforeClose: function(){   $(this).remove();   } //placed here
        }).bind('dialogclose', function() {
            jdialog.dialog('destroy');
        }).load(url, function() {
            $(this).dialog("option", "position", ['center', 'center'] ).bind('dialogopen', function() {
                    adjustJQueryDialogOverlay();
                });
                $(this).dialog("open");
        });
}

$(window).resize(function() {
    $(".ui-dialog-content").dialog("option", "position", ['center', 'center']);
});