首頁 > web前端 > html教學 > bootstrap中模態框、模態框的屬性

bootstrap中模態框、模態框的屬性

高洛峰
發布: 2017-02-20 11:16:15
原創
1731 人瀏覽過

工作上有需要用到模態框的可以看看

<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退出鍵無效。同樣是為了避免突然的誤操作導致模態框關閉。

 

 

<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中文網!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板