bootbox.dialog不显示

时间:2017-08-24 14:29:45

标签: javascript twitter-bootstrap bootbox

我正在尝试显示自定义对话框。我拿了bootbox文档的例子,我无法使它工作。 请注意,当我在结束时取消注释警报时,会显示该对话框。

以下是代码:

      var dialog = bootbox.dialog({
            title: 'A custom dialog with buttons and callbacks',
            message: "<p>This dialog has buttons. Each button has it's own callback function.</p>",
            buttons: {
                cancel: {
                    label: "I'm a custom cancel button!",
                    className: 'btn-danger',
                    callback: function () {
                        Example.show('Custom cancel clicked');
                    }
                },
                noclose: {
                    label: "I'm a custom button, but I don't close the modal!",
                    className: 'btn-warning',
                    callback: function () {
                        Example.show('Custom button clicked');
                        return false;
                    }
                },
                ok: {
                    label: "I'm a custom OK button!",
                    className: 'btn-info',
                    callback: function () {
                        Example.show('Custom OK clicked');
                    }
                }
            },
            show :false
        });
        dialog.on("shown.bs.modal", function () {
            alert('it worked!');
        });

        dialog.modal('show');
        //alert(test);

导入:

<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">

<script src="~/Content/js/bootstrap-toggle.min.js" type="text/javascript"></script>

<script src="/Content/js/bootbox.min.js"></script>

感谢您的帮助。

0 个答案:

没有答案