简体   繁体   English

Twitter Bootstrap:如何关闭模态对话框?

[英]Twitter Bootstrap: How to close modal dialog?

I'm trying to implement modal loading dialog with Twitter's bootstrap. 我正在尝试用Twitter的bootstrap实现模态加载对话框。 My current attemp is: 我目前的尝试是:

$(document).ready(function () {

    $('#loading_dialog')
        .ajaxStart(function () {
            $(this).modal('show');
        })
        .ajaxStop(function () {
            $(this).modal('hide');
        });
});

Problem is that the dialog won't close. 问题是对话框不会关闭。

I didn't test it but the issue could depend on the context of the ajaxStart/Stop anonymous function. 我没有测试它,但问题可能取决于ajaxStart / Stop匿名函数的上下文。

Can you try this? 你能试试吗?

var loading_dialog = $('#loading_dialog');
loading_dialog
    .ajaxStart(function () {
        loading_dialog.modal('show');
    })
    .ajaxStop(function () {
        loading_dialog.modal('hide');
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM