簡體   English   中英

單擊外部或按 Esc 時如何防止自定義框模態消失

[英]How to Prevent Custom box Modal from disappearing when clicking outside or pressing escape

在這里,我使用 Custombox 模態插件來獲得良好的效果。 我使用以下鏈接初始化了插件

<link href="assets/libs/custombox/custombox.min.css" rel="stylesheet">
<script src="assets/libs/custombox/custombox.min.js"></script>

我創建了一個模態。 一切正常,但是當我嘗試添加時

數據背景 = '靜態'

數據鍵盤 = '假'

不工作。 自定義模態框有什么問題。 當我使用基本的 Bootstrap 模態背景時,鍵盤數據屬性運行良好。

按鈕代碼

<a href="#edit-profile" class="btn btn-dark waves-effect waves-light btn-edit" data-animation="slidetogether" data-plugin="custommodal" data-overlaySpeed="100" data-overlayColor="#36404a" data-backdrop="static" data-keyboard="false">edit</a>

模態代碼

<div id="edit-profile" class="modal-demo" >
    <button type="button" class="close" onclick="Custombox.modal.close();">
      <span>&times;</span><span class="sr-only">Close</span>
    </button>
    <h4 class="custom-modal-title">Profile</h4>
    <div class="custom-modal-text">      
    </div>
  </div>

嘗試將此選項添加到您的模態

new Custombox.modal({
  // Options
  content: {
    close: false,
  },
  overlay: {
    close: false,
  }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM