From 615dcb5ca068b1290cfd74d0f3b30272328f60fa Mon Sep 17 00:00:00 2001 From: fat Date: Sun, 16 Mar 2014 18:38:47 -0700 Subject: [PATCH 1/2] fixes #9855 --- js/modal.js | 35 +++++++++++++++++++++++++++++------ less/modals.less | 9 +++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/js/modal.js b/js/modal.js index f6dc477b10..454d7d57a3 100644 --- a/js/modal.js +++ b/js/modal.js @@ -15,6 +15,7 @@ var Modal = function (element, options) { this.options = options + this.$body = $(document.body) this.$element = $(element) this.$backdrop = this.isShown = null @@ -48,6 +49,9 @@ this.isShown = true + this.$body.addClass('modal-open') + + this.setScrollbar() this.escape() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) @@ -56,7 +60,7 @@ var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { - that.$element.appendTo(document.body) // don't move modals dom position + that.$element.appendTo(that.$body) // don't move modals dom position } that.$element @@ -96,6 +100,9 @@ this.isShown = false + this.$body.removeClass('modal-open') + + this.resetScrollbar() this.escape() $(document).off('focusin.bs.modal') @@ -153,7 +160,7 @@ var doAnimate = $.support.transition && animate this.$backdrop = $('