日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

Bootstrap模态框(modal)显示、隐藏与禁用ESC代码实现

發(fā)布時(shí)間:2025/3/19 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Bootstrap模态框(modal)显示、隐藏与禁用ESC代码实现 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

場(chǎng)景

對(duì)于彈出框bootstrap就有模態(tài)框(modal)。

有時(shí)顯示模態(tài)框,按鍵盤(pán)上ESC就會(huì)關(guān)閉模態(tài)框,所以在打開(kāi)模態(tài)框時(shí)設(shè)置其屬性。

實(shí)現(xiàn)

modal顯示:

?$("#apAddAndEidtModel").modal('show');

modal隱藏:

$("#apAddAndEidtModel").modal('hide');

modal禁用Esc:

$("#apImportModel").modal({show:true, keyboard:false});

?

示例代碼

頁(yè)面代碼:

<div class="modal inmodal" id="apImportModel" tabindex="-1" role="dialog"? aria-hidden="true"><div class="modal-dialog" id="apImportDiv" th:fragment="apImportDiv"><div class="modal-content animated fadeIn"><button type="button" class="close" onclick="return Testclose();" id="closeUploadBtn"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button><form? class="dropzone"? id="dropzoneForm" enctype="multipart/form-data"><div class="fallback"><input name="file" value="1M以?xún)?nèi)的Excel文件" type="file" id="file_id"? accept=".xls,.xlsx" onchange="fileChange(this);" /></div></form><button id="uploladBtn" class="btn btn-info mt-2" type="button" onclick="return uploadExcel()"><i class="fa fa-reply"></i>上傳</button><button id="parseBtn" class="btn btn-info mt-2" type="button" onclick="return parseExcel()"><i class="fa fa-reply"></i>導(dǎo)入</button></div></div></div>

?

js代碼:

?//導(dǎo)入Excel操作function importExcel(){$("#apImportModel").modal({show:true, keyboard:false});} //關(guān)閉窗口操作 function Testclose(){debugger$("#apImportModel").modal('hide');$("#file_id").val(null);return false; }

?

總結(jié)

以上是生活随笔為你收集整理的Bootstrap模态框(modal)显示、隐藏与禁用ESC代码实现的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。