From 9936cd02c66cc813d71940a4c31d653f1b02101d Mon Sep 17 00:00:00 2001 From: jlukic Date: Fri, 5 Sep 2014 13:52:58 -0400 Subject: [PATCH] Backport of modal positioning fix --- src/modules/modal.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modules/modal.js b/src/modules/modal.js index df1aa99a0..8d14108e5 100755 --- a/src/modules/modal.js +++ b/src/modules/modal.js @@ -456,17 +456,24 @@ $.fn.modal = function(parameters) { } }, + cacheSizes: function() { - module.cache = { - pageHeight : $body.outerHeight(), - height : $module.outerHeight() + settings.offset, - contextHeight : (settings.context == 'body') - ? $(window).height() - : $dimmable.height() - }; - module.debug('Caching modal and container sizes', module.cache); + var + modalHeight = $module.outerHeight() + ; + if(modalHeight !== 0) { + module.cache = { + pageHeight : $(document).outerHeight(), + height : modalHeight + settings.offset, + contextHeight : (settings.context == 'body') + ? $(window).height() + : $dimmable.height() + }; + module.debug('Caching modal and container sizes', module.cache); + } }, + can: { fit: function() { return (module.cache.height < module.cache.contextHeight);