backbone.bootstrap-modal icon indicating copy to clipboard operation
backbone.bootstrap-modal copied to clipboard

Bootstrap modal "shown" event not working when "animate" property is set to "false"

Open titaniumteeth opened this issue 11 years ago • 4 comments

If I set animate: true, then shown event is working just fine.

Issue demo: http://jsfiddle.net/nzLSA/40/

titaniumteeth avatar Jan 20 '14 20:01 titaniumteeth

I can confirm this.

betaprior avatar May 16 '14 03:05 betaprior

Confirming as well.

DavsX avatar Jul 28 '14 12:07 DavsX

+1

marcovc avatar Feb 23 '15 13:02 marcovc

The 'shown.bs.modal' event is triggered by

$el.modal({
        keyboard: this.options.allowCancel,
        backdrop: this.options.allowCancel ? true : 'static'
      });

The event binding follows immediately after, so the event listener doesn't exist when the event is triggered.

It appears that in the master branch, the code now looks like this:

$el.modal(_.extend({
        keyboard: this.options.allowCancel,
        backdrop: this.options.allowCancel ? true : 'static'
      }, this.options.modalOptions));

So in theory (i havent tested this yet) you could add 'show': false to the options and have it create but not display the modal, then the event listener would be added, then you could show the modal at your leisure and the event should be handled.

dieselmachine avatar Jan 23 '18 23:01 dieselmachine