diff options
Diffstat (limited to 'js/modal.js')
| -rw-r--r-- | js/modal.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/js/modal.js b/js/modal.js index a89eb0c09..f23ba825f 100644 --- a/js/modal.js +++ b/js/modal.js @@ -188,7 +188,7 @@ } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') - var callbackRemove = function() { + var callbackRemove = function () { that.removeBackdrop() callback && callback() } @@ -208,8 +208,8 @@ this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar() } - Modal.prototype.setScrollbar = function () { - var bodyPad = parseInt(this.$body.css('padding-right') || 0) + Modal.prototype.setScrollbar = function () { + var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) } @@ -268,10 +268,13 @@ if ($this.is('a')) e.preventDefault() - Plugin.call($target, option, this) - $target.one('hide.bs.modal', function () { - $this.is(':visible') && $this.trigger('focus') + $target.one('show.bs.modal', function (showEvent) { + if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown + $target.one('hidden.bs.modal', function () { + $this.is(':visible') && $this.trigger('focus') + }) }) + Plugin.call($target, option, this) }) }(jQuery); |
