bootstrap中模态框、模态框的属性

高洛峰
发布: 2017-02-20 11:16:15
原创
1905人浏览过

工作中有需要用到模态框的可以看看

<p class="modal fade" id="userModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
        <p class="modal-dialog">
            <p class="modal-content">
                <p class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="btnCancel">
                        &times;                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        前台菜单管理                    </h4>
                </p>

                    <p class="modal-body">
                        <p>

                            <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>
                        </p>
                    </p>
                    <p 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>
                    </p>


            </p><!-- /.modal-content -->
        </p><!-- /.modal -->
    </p>
登录后复制

 

其中模态框有个属性可以避免点击遮罩层导致模态框关闭。就是p中设置的 data-backdrop="static"。这样可以避免在模态框中输入内容时突然的误操作导致模态框关闭。

另外还有一个属性:data-keyboard="false"。此举是设置按下ESC退出键无效。同样是为了避免突然的误操作导致模态框关闭。

 

百灵大模型
百灵大模型

蚂蚁集团自研的多模态AI大模型系列

百灵大模型 177
查看详情 百灵大模型

 

<p 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>

</p>
登录后复制

其中按钮属性 data-toggle="modal" data-target="#userModal" 是打开模态框。

更多bootstrap中模态框、模态框的属性 相关文章请关注PHP中文网!

相关标签:
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号