]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Modal: Work around IE scrollbars not taking up page width 15378/head
authorHeinrich Fenkart <hnrch02@gmail.com>
Tue, 16 Dec 2014 05:23:04 +0000 (06:23 +0100)
committerHeinrich Fenkart <hnrch02@gmail.com>
Thu, 18 Dec 2014 06:29:34 +0000 (07:29 +0100)
Fixes #15353.

js/modal.js

index 93891aa4eb26b8fdeb1423c4dafdc3ab2432a99b..6d68edc1f6e0241627ef1036c49842840046c3f6 100644 (file)
   }
 
   Modal.prototype.checkScrollbar = function () {
-    this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight
+    var fullWindowWidth = window.innerWidth
+    if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
+      var documentElementRect = document.documentElement.getBoundingClientRect()
+      fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
+    }
+    this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
     this.scrollbarWidth = this.measureScrollbar()
   }