diff --git a/css/bootstrap-modal.css b/css/bootstrap-modal.css index b1d2899..520da9e 100644 --- a/css/bootstrap-modal.css +++ b/css/bootstrap-modal.css @@ -36,14 +36,34 @@ left: 0; right: 0; overflow: auto; + text-align: center; +} + +.modal-scrollable .modal { + text-align: left; +} + +.modal-scrollable:after { + content: ""; + height: 100%; + width: 0; + display: inline-block; + vertical-align: middle; } .modal { outline: none; - position: absolute; - margin-top: 0; - top: 50%; + position: relative; + margin: 0; + width: auto; + top: auto; + left: auto; + right: auto; + bottom: auto; overflow: visible; /* allow content to popup out (i.e tooltips) */ + display: inline-block; + vertical-align: middle; + min-width: 530px; } .modal.fade { @@ -55,7 +75,7 @@ } .modal.fade.in { - top: 50%; + top: 0; } .modal-body { @@ -91,8 +111,7 @@ } .modal.container { - width: 940px; - margin-left: -470px; + max-width: 940px; } /* Modal Overflow */ @@ -118,8 +137,7 @@ @media (min-width: 1200px) { .modal.container { - width: 1170px; - margin-left: -585px; + max-width: 1170px; } } diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index 5a40400..e1a6d70 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -65,15 +65,6 @@ if (this.options.width){ this.$element.css('width', this.options.width); - - var that = this; - this.$element.css('margin-left', function () { - if (/%/ig.test(that.options.width)){ - return -(parseInt(that.options.width) / 2) + '%'; - } else { - return -($(this).width() / 2) + 'px'; - } - }); } var prop = this.options.height ? 'height' : 'max-height'; @@ -352,4 +343,4 @@ }); }); -}(window.jQuery); \ No newline at end of file +}(window.jQuery); diff --git a/js/bootstrap-modalmanager.js b/js/bootstrap-modalmanager.js index 4a865f5..7d676d0 100644 --- a/js/bootstrap-modalmanager.js +++ b/js/bootstrap-modalmanager.js @@ -69,14 +69,12 @@ modal.$element.show(); if (transition) { - modal.$element[0].style.display = 'run-in'; modal.$element[0].offsetWidth; - modal.$element.one($.support.transition.end, function () { modal.$element[0].style.display = 'block' }); + modal.$element.one($.support.transition.end, function () { modal.$element.show(); }); } modal.$element .toggleClass('modal-overflow', modalOverflow) - .css('margin-top', modalOverflow ? 0 : 0 - modal.$element.height()/2) .addClass('in') .attr('aria-hidden', false); @@ -367,4 +365,4 @@ $.fn.modalmanager.Constructor = ModalManager -}(jQuery); \ No newline at end of file +}(jQuery);