Modal boxes and properties of modal boxes in bootstrap

高洛峰
Release: 2017-02-20 11:16:15
Original
1701 people have browsed it

If you need to use the modal box at work, you can take a look

<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>
Copy after login

The modal box has an attribute that can be avoided Clicking on the mask layer causes the modal to close. It is the data-backdrop="static" set in p. This can prevent the modal box from closing due to sudden misoperations when entering content in the modal box.

There is also another attribute: data-keyboard="false". This is to set the ESC exit key to be invalid. The same is to avoid sudden misoperation causing the modal box to close.

<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>
Copy after login

The button attribute data-toggle="modal" data-target="#userModal" is to open the modal box.

For more modal boxes and properties of modal boxes in bootstrap, please pay attention to the PHP Chinese website for related articles!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template