带有模态背景的 jQuery 引导程序模态和引导框

问题描述

我正在使用模态引导程序和 bootBox.js

在下面的演示中,当您打开模态并单击删除时,将显示模态。现在我的问题是如何在单击删除按钮后设置模态背景?

$('.delete').on('click',function()
{
  bootBox.dialog(
  {
    message: "Are you sure you want to delete this?</b>",title: "<i class='glyphicon glyphicon-trash'></i> Delete",buttons:
    {
      success:
      {
        label: "No",className: "btn-success",callback: function()
        {
          $('.bootBox').modal('hide');
        }
      },danger:
      {
        label: "Delete",className: "btn-danger",callback: function()
        {
          $('#'+ID).click(function()
          {
            return false;
          });

          $.ajax(
          {
            type: "POST",url: "deleteNews",data:
            {
              ID: ID,datas: datas
            },success: function(msg)
            {
              if(msg == "newsDeleted")
              {
                $('tr#'+ID).fadeOut('slow',function()
                {
                  $(this).remove();

                  $(".tNewsticker tr").find(".up,.up i,.down,.down i").css({
                    "pointer-events": "auto","color": "#7b7b7b"
                  });

                  $(".tNewsticker tr:first").find(".up,.up i").css({
                    "pointer-events": "none","color": "#e7e7e7"
                  });

                  $(".tNewsticker tr:last").find(".down,.down i").css({
                    "pointer-events": "none","color": "#e7e7e7"
                  });
                });

                buttonClicked();
                $.simplyToast('success','News has been deleted');
              }
            }
          });
        }
      }
    }
  });
});
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <Meta charset="utf-8">
  <Meta name="viewport" content="width=device-width,initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/bootBox.js/5.5.2/bootBox.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Modal Example</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>Some text in the modal.</p>
          <button class="delete">Delete</button>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
      
    </div>
  </div>
  
</div>

</body>
</html>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)