对于模态框的使用
来源:互联网 发布:凯迪拉克atsl轮毂数据 编辑:程序博客网 时间:2024/06/05 19:22
对于模态框的使用,我一直都是看多了模糊的记得如何使用,但用起来的时候因为一个小错误导致调式很长时间,现在决定系统的去学习一下:先看这个例子:
<!-- Button trigger modal --><button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Launch demo modal</button><!-- Modal --><div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Modal title</h4> </div> <div class="modal-body"> ... </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> </div></div>
务必为 .modal 添加 role=”dialog” 和 aria-labelledby=”…” 属性,用于指向模态框的标题栏;
为 .modal-dialog 添加 aria-hidden=”true” 属性。
aria-hidden字符串。可选值为true和false,true表示元素隐藏(不可见),false表示元素可见。
.fade 表示淡入淡出的效果。
2.模态框提供了两个可选尺寸,通过为 .modal-dialog 增加一个样式调整类实现。bs-example-modal-lg和bs-example-modal-sm
<!-- Large modal --><button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button><div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> ... </div> </div></div><!-- Small modal --><button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">Small modal</button><div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel"> <div class="modal-dialog modal-sm" role="document"> <div class="modal-content"> ... </div> </div></div>
不需写 JavaScript 代码也可激活模态框。通过在一个起控制器作用的元素(例如:按钮)上添加 data-toggle=”modal” 属性
<button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button>
或者
只需一行 JavaScript 代码,即可通过元素的 id myModal 调用模态框:$('#myModal').modal(options)
0 0
- 对于模态框的使用
- 对于cookie的使用
- 对于多线程的使用
- 对于默认值的使用
- 对于虚拟机的使用
- 对于Toast的使用
- 对于触发器使用的思考
- 我对于浏览器的使用
- 对于使用jquery_ztree的感触
- 对于简单JXLS的使用
- 对于saveOrUpdate的正确使用
- 对于学校泳池的使用
- 对于foreach循环的使用
- 对于io流的使用
- 对于startActivity的使用改进
- 对于Linux的初级使用
- 对于table标签的使用
- 对于ztree的使用详解
- 深入剖析Tomcat 第二章 一个简单的Servlet服务器
- 解决intellij idea新建maven项目,加载archetype模型很慢
- 设计模式
- LeetCode之Palindrome Number(回文数)
- MIT的《深度学习》精读(9)
- 对于模态框的使用
- 2017 BAT某家实习生电面---第一次电面的惨痛经历
- webrtc 的回声抵消算法
- 页面滚动时,动态添加css动画
- LeetCode 141. Linked List Cycle(C++版)
- 大小堆实现
- Spring学习笔记2017.03.24
- Android屏幕适配(个人的一点点总结及经验)
- 3.vue.js迭代处理数组