bootstrap中模態(tài)框、模態(tài)框的屬性實(shí)例詳解
工作中有需要用到模態(tài)框的可以看看
<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"> 前臺(tái)菜單管理 </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>動(dòng)作類型:</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">關(guān)閉</button> <button type="submit" class="btn btn-primary" id="btnSave">保存</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal --> </div>
其中模態(tài)框有個(gè)屬性可以避免點(diǎn)擊遮罩層導(dǎo)致模態(tài)框關(guān)閉。就是div中設(shè)置的 data-backdrop="static"。這樣可以避免在模態(tài)框中輸入內(nèi)容時(shí)突然的誤操作導(dǎo)致模態(tài)框關(guān)閉。
另外還有一個(gè)屬性:data-keyboard="false"
。此舉是設(shè)置按下ESC退出鍵無(wú)效。同樣是為了避免突然的誤操作導(dǎo)致模態(tài)框關(guān)閉。
<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"
是打開模態(tài)框。
相關(guān)文章
javascript陷阱 一不小心你就中招了(字符運(yùn)算)
看似簡(jiǎn)單的加法運(yùn)行,卻有很多問(wèn)題,一定要注意字符與數(shù)字的運(yùn)算,注意使用js的強(qiáng)制類型轉(zhuǎn)換,否則會(huì)出現(xiàn)很多問(wèn)題。我們?cè)诰帉慾s的過(guò)程中,最好通過(guò)alert逐行測(cè)試2013-11-11判斷用戶的在線狀態(tài) onbeforeunload事件
window.event.clientX和window.event.clientY 將捕捉當(dāng)前事件發(fā)生時(shí)鼠標(biāo)相對(duì)與窗口的桌面坐標(biāo),通常情況下IE的關(guān)閉按鈕都會(huì)在頁(yè)面的右上部分,所以點(diǎn)關(guān)閉的時(shí)候鼠標(biāo)的坐標(biāo)的Y坐標(biāo)一定是小于0的2011-03-03JS+CSS實(shí)現(xiàn)六級(jí)網(wǎng)站導(dǎo)航主菜單效果
這篇文章主要介紹了JS+CSS實(shí)現(xiàn)六級(jí)網(wǎng)站導(dǎo)航主菜單效果,涉及JavaScript遍歷頁(yè)面元素及動(dòng)態(tài)修改css屬性的相關(guān)實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-09-09JavaScript實(shí)現(xiàn)H5接金幣功能(實(shí)例代碼)
這篇文章主要介紹了JavaScript實(shí)現(xiàn)H5接金幣功能,本文分步驟通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-02-02