【问题标题】:jquery ui dialog positionjquery ui对话框位置
【发布时间】:2013-06-21 12:07:38
【问题描述】:

如何设置 jquery ui 对话框的位置。当我在表单中单击完成时,对话框的位置位于页面顶部..

这是我如何调用对话框:

            <div id="dialog" style="display: none;">
                <h1>Transaction successful!</h1>
                <br />

                <h3>Thank you.</h3>
            </div>

    ScriptManager.RegisterStartupScript(this, this.GetType(), "showmessage", "jQuery('#dialog').dialog({ dialogClass: 'no-close',  title: 'Registration Successful', autoOpen: true,  height: 300, width: 600, modal: true, draggable: true, resizable: false, buttons: { Ok: function () { window.location.replace('Login.aspx'); } } }); ", true);

请帮忙...

【问题讨论】:

    标签: jquery asp.net modal-dialog jquery-ui-dialog


    【解决方案1】:

    您可以为此使用可选参数POSITION

    $( ".selector" ).dialog({ position: { my: "left top", at: "left bottom", of: button } });
    

    更多信息请参见http://api.jqueryui.com/dialog/#option-position

    根据现有代码编辑示例:

     ScriptManager.RegisterStartupScript(this, this.GetType()
     , "showmessage"
     , "jQuery('#dialog').dialog({ 
       dialogClass: 'no-close'
       ,  title: 'Registration Successful'
       , autoOpen: true
       ,  height: 300
       , width: 600
       , modal: true
       , draggable: true
       , resizable: false
       , position: { my: "left top", at: "left bottom", of: button } //as per the jqueryUI example will need to customize for your needs.
       , buttons: { Ok: function () { window.location.replace('Login.aspx'); } } }); ", true);
    

    【讨论】:

    • 我如何在我的代码后面调用它..我没有为对话框创建一个 jquery 函数而是我在我的代码后面调用它...
    • 问题...我将如何设置我的:“左上角”,位于:“左下角”,的:按钮?抱歉之前没有使用过这个..我尝试这样做:位置:{我的:'left',在:'left',of:按钮}当我运行我的代码时,它不显示对话框..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-13
    • 2011-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多