简体   繁体   English

使用javascript进行引导模式调用,最佳做法

[英]Bootstrap modal call with javascript, best practice

First of all, I have 5 modals in layout. 首先,我在布局中有5个模态。

  1. Loading 载入中
  2. Success 成功
  3. Error 错误
  4. Info 信息
  5. Dialogue 对话

And I am calling them like: 我这样称呼他们:

MessageBox.show('modaltype', 'message');

So my actual concern is, my function is sth like: 所以我真正关心的是,我的功能是这样的:

var MessageBox = function($,undefined) {

    return {
        show = function(type,message) {
        }
    }
}(jQuery)

Is this the right way to do so? 这是正确的方法吗? Do you suggest sth more efficient? 您建议更有效吗?

Here you can check the jquery btn click function call bootstrap modal: 在这里,您可以检查jquery btn click函数调用引导模态:

$("#buttom id").click(function(event){
$("#modalboxid").modal('show');
});

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

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