diff options
| author | Mark Otto <[email protected]> | 2014-06-08 11:19:35 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2014-06-08 11:19:35 -0700 |
| commit | 34891de173f1ea1dfd470d4cdeed52f83d9a253b (patch) | |
| tree | a7cb7aaf85bdfce5e1f0a8165879193c327179b6 /js/modal.js | |
| parent | d66b65ddde1b2f1a5cb14f601d30c552c79d7626 (diff) | |
| parent | 1e3b93804fa88d247d8708529fb44b28d73fd91f (diff) | |
| download | bootstrap-34891de173f1ea1dfd470d4cdeed52f83d9a253b.tar.xz bootstrap-34891de173f1ea1dfd470d4cdeed52f83d9a253b.zip | |
grunt
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); |
