Bootbox.js

Bootbox.js是一个小的JavaScript库,它允许您使用Bootstrap模态创建编程对话框,而无需担心创建、管理或删除任何所需的DOM元素或JS事件处理程序。(Bootbox.js is a small JavaScript library which allows you to create programmatic dialog boxes using Bootstrap modals, without having to worry about creating, managing

Github星跟踪图

Bootbox.js是一个小的JavaScript库,它允许您使用Bootstrap模态创建编程对话框,而无需担心创建、管理或删除任何所需的DOM元素或JS事件处理程序。 这里是最简单的例子:

bootbox.alert("Hello world!");<span class="redactor-invisible-space"></span>
将它与您在没有Bootbox的情况下编写的代码进行比较:

该库提供了三个旨在模仿其原生JavaScript等效项的函数。 他们确切的函数签名是灵活的,因为每个可以采取各种参数来自定义标签和指定默认值,但它们最常被称为如此:

alert
bootbox.alert(message, callback)
prompt
bootbox.prompt(message, callback)
confirm
bootbox.confirm(message, callback)

这三个函数中的每一个都调用第四个公共函数,你也可以使用它来创建自己的自定义对话框:

bootbox.dialog(options)

每个函数的使用及每个对话框可用的选项可参考文档。 您还可以在(适当命名的)示例页面中找到如何使用这些函数的示例。

请注意:
使用Bootbox对话框代替原生对话框有一些注意事项。 有关详细信息,请参阅文档页面中的已知限制部分

主要指标

概览
名称与所有者bootboxjs/bootbox
主编程语言JavaScript
编程语言JavaScript (语言数: 2)
平台
许可证Other
所有者活动
创建于2011-11-05 15:02:47
推送于2025-06-15 22:12:50
最后一次提交2025-06-03 15:16:08
发布数47
最新版本名称v6.0.4 (发布于 )
第一版名称v1.0.0 (发布于 2011-12-12 09:36:50)
用户参与
星数5k
关注者数189
派生数1k
提交数785
已启用问题?
问题数594
打开的问题数4
拉请求数162
打开的拉请求数1
关闭的拉请求数114
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

Bootbox - Bootstrap powered alert, confirm and flexible dialog boxes

Please see http://bootboxjs.com for full usage instructions, or head over to http://paynedigital.com/bootbox for
the original writeup about the project.

Contact

Gitter

The easiest thing is to find me on twitter @makeusabrew.

Contributing

Please see the CONTRIBUTING file for guidelines.

Running Tests Build Status

Tests are run using Karma using the Mocha test adapter.
To run the tests yourself, simply run npm install within the project followed by npm test.
Please note that this will require PhantomJS being installed and in your path - if
it is not, you may run the tests and capture browsers manually by running karma start from the root
of the project.

The project is also hosted on Travis CI - when submitting
pull requests please ensure your tests pass as failing requests will be rejected. See the
CONTRIBUTING file for more information.

A note on Bootstrap dependencies

Bootbox 5.0.0 is the first release to support Bootstrap 4.0.0.

Bootbox 4.0.0 is the first release to support Bootstrap 3.0.0.

Bootbox 3.3.0 is the last release to support Bootstrap 2.2.x.

Much more dependency information can be found on the Bootbox website.

5.4.0 (Latest Release)

  • Adds function hooks for onShow, onShown, onHide, and onHidden events, which map to their Bootstrap modal equivalents.

For a full list of releases and changes please see the changelog.

License

(The MIT License)

Copyright (C) 2011-2020 by Nick Payne nick@kurai.co.uk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE