jBox icon indicating copy to clipboard operation
jBox copied to clipboard

How to prevent jBox from closing?

Open samcov opened this issue 2 years ago • 2 comments

How to I get jBox to NOT close if I check a condition and I want them to go back and fix.

There is a "onClose", where I can confirm, but returning false doesn't work, it closes anyway. I use the "onCloseComplete" to finalize everything.

What must I do to prevent closing in the "onClose" event?

samcov avatar Mar 01 '23 01:03 samcov

Maybe you could use the methods this.disable() and this.enable(), see here: https://stephanwagner.me/jBox/methods#disable-and-enable

When you use this.disable(), jBox won't close or open anymore. Once the condition is met, you could use this.enable(); this.close() to close the jBox.

If that doesn't work you could try using this.open() in onClose(), but that's very hacky.

StephanWagner avatar Mar 03 '23 22:03 StephanWagner

@samcov try this.isOpen = false;, for example

onClose: function() {
  this.isOpen = false;
  if (someCond) {
    this.isOpen = true;
  }
}

idistack avatar May 07 '23 10:05 idistack