Bootstrap如何隐藏模态
How does Bootstrap hide the modal?
引导程序是否使用Javascript?比如,首先加载HTML,然后JS代码分析我的引导模式的属性,并为此添加功能(淡入、淡出等)?它包含在bootstrap.js中吗?
例如,我知道它会触发一些事件,所以它们必须在Bootstrap的源代码中定义。
是。它使用Javascript框架工作Jquery进行所有操作。Bootstrap.js使用jquery并显示模态。
它使用HTML5数据属性来调用modal。
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
引导程序中发生的所有操作都是由于以下文件。你可以在'bootstrap.min.css'中找到的所有类
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
我希望这就是你想要的。
是的,您可以从boostrap/modal.js 中搜索以下代码
例如,
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
var href = $this.attr('href')
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^'s]+$)/, ''))) // strip for ie7
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
if ($this.is('a')) e.preventDefault()
$target.one('show.bs.modal', function (showEvent) {
if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
$target.one('hidden.bs.modal', function () {
$this.is(':visible') && $this.trigger('focus')
})
})
Plugin.call($target, option, this)
})
相关文章:
- 将隐藏输入类型转移到我的隐藏模态/表单
- 使用模态上的文件输入字段更新主视图上的隐藏字段
- 角度JS.超时模态隐藏在已打开的模态后面
- 如何在没有背景的情况下隐藏模态弹出窗口
- 分解javascript/jquery代码,以便在单击外部时隐藏模态
- NgAnimate - 由于 NGAnimate,我的模态显示隐藏不起作用
- jQueryUI 自动完成隐藏在模态后面
- Angular JS:隐藏/关闭模态
- 滚动以隐藏Javascript模态
- 隐藏Angular Bootstrap模态而不是关闭
- Bootstrap如何隐藏模态
- 如何使用纯javascript显示和隐藏模态对话框
- 如果条件为假,隐藏第二个模态
- Onsen UI模态在angularjs中是不隐藏的
- 如何在模态渐变中隐藏元素
- 隐藏模态后,模态中文本框的值没有被清除
- 禁用隐藏模态窗口时,点击退出模态jquery
- 我如何在渲染模板和隐藏模态后重置表单
- 通过背景点击来消除模态和隐藏模态
- 如何在每次隐藏模态时重置模态内容(removeData() 不起作用)