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);