diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index c125bd5..f34ec8c 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -141,6 +141,10 @@ .css('margin-top', 0 - this.$element.height() / 2) .removeClass('modal-overflow'); } + + this.$element.data('height',this.$element.height()) + this.$element.data('width',this.$element.width()) + }, tab: function () { diff --git a/js/bootstrap-modalmanager.js b/js/bootstrap-modalmanager.js index 1982975..fa23d6c 100644 --- a/js/bootstrap-modalmanager.js +++ b/js/bootstrap-modalmanager.js @@ -49,6 +49,19 @@ } }, 10); }); + // listen to 'change' event, checking if modal-size changed and call 'layout'. + $(document).on('change.modal','.modal.modal-reposition',function(e){ + var $target = $(e.currentTarget) + , modal = $target.data('modal'); + if (modal && modal.isShown){ + setTimeout( + function(){ + if ($target.height()!=$target.data('height') || $target.width()!=$target.data('width')) + modal.layout() + } + ,$target.data('repositionwait') || that.options.repositionWait || 300); + } + }); } },