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

來源:互聯網
上載者:User

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

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

<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">                        &times;                    </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" 是開啟模態框。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.