Jump to the post that solved this thread.
Solved: 1 Year, 10 Months, 2 Weeks ago Modal gets stuck on bottom when clicked repeatedly
#17
Solved: 1 Year, 10 Months, 2 Weeks ago
The problem is here: https://github.com/mybb/mybb/blob/mybb_1...ns.js#L340

The jQuery modal plugin have an option to delay the show of the box and it does it using setTimeout. But soon after you can see that it adds the event handlers to manage the closure of the modal, this means: I can close the modal before the box is showed.

Fast solution, remove in jscripts/jquery.plugins.js (jscripts/jquery.plugins.min.js needs to be updated too) from the open method:

$(document).off('keydown.modal').on('keydown.modal', function(event) {
  var current = getCurrent();
  if (event.which == 27 && current.options.escapeClose) current.close();
});
if (this.options.clickClose)
  this.$blocker.on('click',function(e) {
    if (e.target==this)
      $.modal.close();
  });

and move it at the end of the show method

show: function() {
  this.$elm.trigger($.modal.BEFORE_OPEN, [this._ctx()]);
  if (this.options.showClose) {
    this.closeButton = $('<a href="#close-modal" rel="modal:close" class="close-modal ' + this.options.closeClass + '">' + this.options.closeText + '</a>');
    this.$elm.append(this.closeButton);
  }
  this.$elm.addClass(this.options.modalClass).appendTo(this.$blocker);
  if(this.options.doFade) {
    this.$elm.css('opacity',0).show().animate({opacity: 1}, this.options.fadeDuration);
  } else {
    this.$elm.show();
  }
  this.$elm.trigger($.modal.OPEN, [this._ctx()]);
  $(document).off('keydown.modal').on('keydown.modal', function(event) {
    var current = getCurrent();
    if (event.which == 27 && current.options.escapeClose) current.close();
  });
  if (this.options.clickClose)
    this.$blocker.on('click',function(e) {
      if (e.target==this)
        $.modal.close();
    });
},
Reply
Jump to the post that solved this thread.


Messages In This Thread
RE: Modal gets stuck on bottom when clicked repeatedly - by Mipher - 2020-01-10, 10:18 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)