aboutsummaryrefslogtreecommitdiff
path: root/dist/js/bootstrap.js
diff options
context:
space:
mode:
authorTyler Cipriani <[email protected]>2014-03-17 13:04:58 -0600
committerChris Rebert <[email protected]>2014-03-28 23:45:22 -0700
commit0907244256d923807c3a4e55f4ea606b9558d0ca (patch)
treef75f21d4a8d50fc28e94826c148b091742324d8a /dist/js/bootstrap.js
parent28e6c34268b70a0aa3cf32321fecfba568248dbe (diff)
downloadbootstrap-0907244256d923807c3a4e55f4ea606b9558d0ca.tar.xz
bootstrap-0907244256d923807c3a4e55f4ea606b9558d0ca.zip
Modal body shift fix for IE10/11
Closes #13103 by merging it.
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r--dist/js/bootstrap.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js
index 4204a1391..ee11929b8 100644
--- a/dist/js/bootstrap.js
+++ b/dist/js/bootstrap.js
@@ -795,11 +795,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
// ======================
var Modal = function (element, options) {
- this.options = options
- this.$body = $(document.body)
- this.$element = $(element)
- this.$backdrop =
- this.isShown = null
+ this.options = options
+ this.$body = $(document.body)
+ this.$element = $(element)
+ this.$backdrop =
+ this.isShown = null
+ this.scrollbarWidth = 0
if (this.options.remote) {
this.$element
@@ -830,6 +831,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this.isShown = true
+ this.checkScrollbar()
this.$body.addClass('modal-open')
this.setScrollbar()
@@ -976,11 +978,14 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}
}
+ Modal.prototype.checkScrollbar = function () {
+ if (document.body.clientWidth >= window.innerWidth) return
+ this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
+ }
+
Modal.prototype.setScrollbar = function () {
- if (document.body.clientHeight <= window.innerHeight) return
- var scrollbarWidth = this.measureScrollbar()
- var bodyPad = parseInt(this.$body.css('padding-right') || 0)
- if (scrollbarWidth) this.$body.css('padding-right', bodyPad + scrollbarWidth)
+ var bodyPad = parseInt(this.$body.css('padding-right') || 0)
+ if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
}
Modal.prototype.resetScrollbar = function () {