bootstrap中模态框、模态框的属性实例详解
作者:好学的菜鸟 时间:2024-10-16 10:38:54
工作中有需要用到模态框的可以看看
<div class="modal fade" id="userModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="btnCancel">
×
</button>
<h4 class="modal-title" id="myModalLabel">
前台菜单管理
</h4>
</div>
<div class="modal-body">
<div>
<table width="100%" border="0" class="userCon_2">
<tr>
<th width="30%">名称:</th>
<td width="70%">
<input type="text" name="Name" class="form-control" style="border-radius:3px; width:220px;" id="txtName" required="" aria-required="true">
</td>
</tr>
<tr>
<th>动作类型:</th>
<td>
<select class="selectpicker show-tick" id="txtType" style="height: 30px; width: 220px;" name="Type">
<option value="view">view</option>
<option value="click">click</option>
</select>
</td>
</tr>
<tr>
<th>路径:</th>
<td>
<input type="text" name="Url" class="form-control" style="border-radius:3px; width:220px;" id="txtUrl" required="" aria-required="true" />
</td>
</tr>
<tr>
<th>排序:</th>
<td>
<input type="text" name="Rank" class="form-control" style="border-radius:3px; width:220px;" id="txtRank" />
<input type="hidden" name="MainMenuGuid" value="" id="txtMainMenuGuid" />
</td>
</tr>
</table>
</div>
</div>
<div class="modal-footer" style="border-top:none;">
<button type="button" class="btn btn-default" data-dismiss="modal" id="btnClose">关闭</button>
<button type="submit" class="btn btn-primary" id="btnSave">保存</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
其中模态框有个属性可以避免点击遮罩层导致模态框关闭。就是div中设置的 data-backdrop="static"。这样可以避免在模态框中输入内容时突然的误操作导致模态框关闭。
另外还有一个属性:data-keyboard="false"
。此举是设置按下ESC退出键无效。同样是为了避免突然的误操作导致模态框关闭。
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-newAdd" data-toggle="modal" data-target="#userModal">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
</button>
<button id="btn_edit" type="button" class="btn btn-newAdd">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>修改
</button>
<button id="btn_delete" type="button" class="btn btn-newAdd">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
</button>
</div>
其中按钮属性 data-toggle="modal" data-target="#userModal"
是打开模态框。
来源:http://www.cnblogs.com/hmYao/archive/2017/02/17/6408997.html
标签:bootstrap,模态框
0
投稿
猜你喜欢
Python自定义线程池实现方法分析
2021-12-17 09:13:10
Python3 MySQL 数据库连接的使用示例
2024-01-21 18:15:40
Python编程之string相关操作实例详解
2023-01-05 04:17:47
Python中bisect的用法
2023-11-05 08:47:53
Python缓存技术实现过程详解
2023-08-03 12:31:30
js实现axios限制请求队列
2024-05-10 13:59:31
Go Slice进行参数传递如何实现详解
2024-02-16 13:07:46
Centos7 Python3下安装scrapy的详细步骤
2021-12-03 10:59:26
完美解决webstorm启动索引文件卡死的问题
2022-04-05 05:52:29
django admin后管定制-显示字段的实例
2023-07-01 11:34:18
仿天涯底部固定漂浮导航,无JS纯CSS定义
2009-07-06 12:44:00
如何实现删除numpy.array中的行或列
2022-05-09 14:55:03
oracle SQL解析步骤小结
2009-09-30 10:46:00
VS2019创建MFC程序的实现方法
2023-03-30 09:32:34
Linux下mysql 5.6.17 安装图文教程
2024-01-26 10:59:16
centos yum php 7.x 无需删除升级的方法
2023-11-20 14:48:08
jQuery实现用户注册的表单验证示例
2024-04-10 10:36:12
基于Python实现简易学生信息管理系统
2021-04-07 23:19:49
Python验证码识别的方法
2023-05-30 10:22:39
SQL Server元数据的管理与应用
2009-03-16 14:24:00