malsup / blockui

jQuery BlockUI Plugin
http://jquery.malsup.com/block/
1.69k stars 506 forks source link

onUnblock not called on nth (< 1) use #139

Open ericprud opened 7 years ago

ericprud commented 7 years ago

In this HTML/JS, clicking the #go-modal

and then dismissing the modal dialog will give a popup for the first cycle but not for subsequent cycles.

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <script src="https://www.w3.org/scripts/jquery/2.1.4/jquery.min.js"></script>
    <script src="http://malsup.github.io/jquery.blockUI.js" type="text/javascript"></script>
  </head>

  <body>
    <p id="go-modal">click me</p>
    <div id="modelElt" style="display:none;">
      <p><button>OK</button></p>
    </div>
    <script>
$(document).ready(() => {
  $("#go-modal").click(evt => {
    $.blockUI({
      message: $("#modelElt"), css: {
        top: "0",
        left: "0"
      },
      onUnblock: function() { // -- unreliable
        alert("asdf");
      } 
    });
    $("#modelElt").attr("title","Click to dismiss").click(dismissModal);
  });

  function dismissModal (evt) {
    $.unblockUI();
    return true;
  }
});
    </script>
  </body>
</html>