]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fix modal backdrop overlaying the modal's scrollbar 14927/head
authorHeinrich Fenkart <hnrch02@gmail.com>
Thu, 30 Oct 2014 03:46:14 +0000 (04:46 +0100)
committerHeinrich Fenkart <hnrch02@gmail.com>
Tue, 4 Nov 2014 22:17:55 +0000 (23:17 +0100)
Fixes #14916.

js/modal.js
less/modals.less

index 8b0e269bc1fc38081826a6adc7fa6637c7186808..eaf0d716562bfa777bc40045ca668364732b55de 100644 (file)
@@ -60,6 +60,7 @@
 
     this.setScrollbar()
     this.escape()
+    if (this.options.backdrop) this.resize()
 
     this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
 
@@ -74,6 +75,8 @@
         .show()
         .scrollTop(0)
 
+      if (that.options.backdrop) that.setBackdropHeight()
+
       if (transition) {
         that.$element[0].offsetWidth // force reflow
       }
     this.isShown = false
 
     this.escape()
+    if (this.options.backdrop) this.resize()
 
     $(document).off('focusin.bs.modal')
 
     }
   }
 
+  Modal.prototype.resize = function () {
+    if (this.isShown) {
+      $(window).on('resize.bs.modal', $.proxy(this.setBackdropHeight, this))
+    } else {
+      $(window).off('resize.bs.modal')
+    }
+  }
+
   Modal.prototype.hideModal = function () {
     var that = this
     this.$element.hide()
     }
   }
 
+  Modal.prototype.setBackdropHeight = function () {
+    this.$backdrop
+      .css('height', 0)
+      .css('height', this.$element[0].scrollHeight)
+  }
+
   Modal.prototype.checkScrollbar = function () {
     this.scrollbarWidth = this.measureScrollbar()
   }
index 7468b14f97ed2660d1ac58adcb984900deea1ca7..032a497d6c1c50199bcf2150856e8a8e5762bd39 100644 (file)
 
 // Modal background
 .modal-backdrop {
-  position: fixed;
+  position: absolute;
   top: 0;
   right: 0;
-  bottom: 0;
   left: 0;
   background-color: @modal-backdrop-bg;
   // Fade for backdrop