加载twitter bootstrap的掩码插件

时间:2014-03-07 06:12:21

标签: javascript ajax twitter-bootstrap twitter-bootstrap-3

是否存在任何用于在加载AJAX时屏蔽页面内容的引导插件(如https://code.google.com/p/jquery-loadmask)?

对于BS 3。

谢谢!

1 个答案:

答案 0 :(得分:5)

我不认为有(虽然我没有完全的知识 - 我现在正在寻找这个解决方案)。

然而,我确实找到了this blog post,它可以从方便的Bootstrap组件创建一个。

<强> HTML

<div class="modal hide" id="pleaseWaitDialog" data-backdrop="static" data-keyboard="false">
    <div class="modal-header">
        <h1>Processing...</h1>
    </div>
    <div class="modal-body">
        <div class="progress progress-striped active">
            <div class="bar" style="width: 100%;"></div>
        </div>
    </div>
</div>

<强>的JavaScript

var myApp;
myApp = myApp || (function () {
    var pleaseWaitDiv = $('<div class="modal hide" id="pleaseWaitDialog" data-backdrop="static" data-keyboard="false"><div class="modal-header"><h1>Processing...</h1></div><div class="modal-body"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div></div>');
    return {
        showPleaseWait: function() {
            pleaseWaitDiv.modal();
        },
        hidePleaseWait: function () {
            pleaseWaitDiv.modal('hide');
        },

    };
})();

示例用法: myApp.showPleaseWait();

结果: screenshot of the result