1.尺寸大小选项
模态框有两个可选大小,可以通过class定义.modal-dialog(分别是.bd-example-modal-lg和.bd-example-modal-sm,这些尺寸会在某些中断点调整,以避免在较小的viewport窗口上出现水平滚动条。
2.用法:
模态插件通过数据属性或JavaScript按需切换您隐藏的内容。它将.modal-open加到了<body>上,以覆盖默认的滚动行为,并生成.modal-backdrop来提供点击区域,以便在动态模态窗外面点击一下就能移除模态。
3.使用数据属性
启动一个动态视窗而无需编写JavaScript,在控制元素上设置data-toggle="modal"(如按钮),以及一个data-target="#foo" 或 href="#foo" 来指定特定的动态视窗进行切换。
4.通过JavaScript
使用单行JavaScript调用ID为 myModal的动态模态框:
选项:
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-backdrop="".
5.方法:
.modal(options)
激活您的内容作为模态,将选项加入到 object内。
.modal('toggle')
手动切换动态模态框,在动态模态框实际显示或隐藏之前返回给调用者(即在shown.bs.modal 或 hidden.bs.modal事件发生之前)。
.modal('show')
手动打开动态模态框,在动态模态框实际显示之前返回给调用者(即在shown.bs.modal 事件发生前)。
.modal('hide')
手动隐藏动态模态框,在动态模态框实际隐藏之前返回给调用者(即在hidden.bs.modal 事件发生前)。
.modal('handleUpdate')
如果动态模态框在打开状态(比如在出现滚动条的情况下)重新改变高度,并调整模态窗的位置。
.modal('dispose')
销毁一个元素的Modal。
6.事件:
Bootstrap’s modal class exposes a few events for hooking into modal functionality. All modal events are fired at the modal itself (i.e. at the <div>).
模态框有两个可选大小,可以通过class定义.modal-dialog(分别是.bd-example-modal-lg和.bd-example-modal-sm,这些尺寸会在某些中断点调整,以避免在较小的viewport窗口上出现水平滚动条。
2.用法:
模态插件通过数据属性或JavaScript按需切换您隐藏的内容。它将.modal-open加到了<body>上,以覆盖默认的滚动行为,并生成.modal-backdrop来提供点击区域,以便在动态模态窗外面点击一下就能移除模态。
3.使用数据属性
启动一个动态视窗而无需编写JavaScript,在控制元素上设置data-toggle="modal"(如按钮),以及一个data-target="#foo" 或 href="#foo" 来指定特定的动态视窗进行切换。
4.通过JavaScript
使用单行JavaScript调用ID为 myModal的动态模态框:
选项:
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-backdrop="".
5.方法:
.modal(options)
激活您的内容作为模态,将选项加入到 object内。
.modal('toggle')
手动切换动态模态框,在动态模态框实际显示或隐藏之前返回给调用者(即在shown.bs.modal 或 hidden.bs.modal事件发生之前)。
.modal('show')
手动打开动态模态框,在动态模态框实际显示之前返回给调用者(即在shown.bs.modal 事件发生前)。
.modal('hide')
手动隐藏动态模态框,在动态模态框实际隐藏之前返回给调用者(即在hidden.bs.modal 事件发生前)。
.modal('handleUpdate')
如果动态模态框在打开状态(比如在出现滚动条的情况下)重新改变高度,并调整模态窗的位置。
.modal('dispose')
销毁一个元素的Modal。
6.事件:
Bootstrap’s modal class exposes a few events for hooking into modal functionality. All modal events are fired at the modal itself (i.e. at the <div>).