如何关闭模态对话框

如何关闭模态对话框

本文介绍了Twitter的引导:如何关闭模态对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图实现与Twitter的引导模式加载对话框。我现在学尝试为:

I'm trying to implement modal loading dialog with Twitter's 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.

推荐答案

我没有测试它,但问题可能取决于ajaxStart /停止匿名函数的上下文。

I didn't test it but the issue could depend on the context of the ajaxStart/Stop anonymous function.

您可以试试这个?

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

这篇关于Twitter的引导:如何关闭模态对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 03:32