jquery - SimpleModal 调整容器大小

标签 jquery ajax model resize

我用过SimpleModal 。现在的问题是模式对话框的大小调整。 我有一个确认对话框,按"is"后它基本上很小。

第二个是my.php,它包含大量数据。我正在使用的概念 附加一个已经存在的模型。如何调整内容大小?

我的 JavaScript 代码片段有:

$(document).ready(function () {
    $('#confirmbutton, #confirmDialog a.confirm').click(function (e) {
        e.preventDefault();

        confirm("Continue to the SimpleModal project page?", function () {
        window.location.href = 'http://localdata/';
        });
    });
});

function confirm(message, callback) {
    $('#confirm').modal({
        close:false,
        position: ["20%",],
        overlayId:'confirmModalOverlay',
        containerId:'confirmModalContainer',
        onShow: function (dialog) {
            dialog.data.find('.message').append(message);

            // If the user clicks "yes"
            dialog.data.find('.yes').click(function () {
                // Call the callback
                // $.modal.close();

                $.get("my.php", function (data) {
                    /* Sample response:
                     *   <div id="title">My title</div>
                     *   <div id="message">My message</div>
                     *
                    */

                    var resp = $("<div/>").append(data);
                    var title = resp.find("#title").html(),
                    message = resp.find("#message").html();
                    dialog.data.find(".header span").html(title);
                    dialog.data.find(".message").html(message);
                    dialog.data.find(".buttons .yes").hide();
                    dialog.data.find(".buttons .no").hide();

                    //dialog.data.find(".buttons .no").html("Close");

                    // No need to call the callback or $.modal.close()
                });// End for click
            });//End for on show
        } //End for modal
    }); //Close for modal
}

我的CSS:

confirmModalContainer {height:700px; width:700px; font-family:'Trebuchet MS', Verdana, Arial; font-size:16px; text-align:left; background:#fff; border:2px solid #336699;}

如何修改 SimpleModal 容器大小?在 Ajax 调用中?

最佳答案

就这样做......

$("#simplemodal-container").css('height', 'auto'); //To reset the container.
$(window).trigger('resize.simplemodal');           //To refresh the modal dialog.

关于jquery - SimpleModal 调整容器大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/397684/

相关文章:

javascript - Jquery 中两个选择框具有一个功能

php - 从 laravel 4 中的 Controller 调用自定义模型方法

javascript - 动态添加事件监听器到dom

jquery - 是否可以在 render partial 中传递参数?

jQuery-pjax vs history.js 在点击时加载特定内容

javascript - jquery绑定(bind)和取消绑定(bind)没有功能

asp.net - Microsoft.EntityFrameworkCore.dll 中出现类型为 'Microsoft.EntityFrameworkCore.DbUpdateException' 的异常

model-view-controller - 构建用于在多个服务之间共享数据层的 Play 框架模块

jquery - 在 jQuery 中获取多个文本框值 - MVC

javascript - jQuery .click() 在 Firebug 中有效,但在 Greasemonkey 脚本中无效?