From: Coleman Watts Date: Thu, 28 Aug 2014 15:52:34 +0000 (+0100) Subject: More accurate dialog size calculations X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=28d510ab1574a956b02fab6bf17a4635172d4f2b;p=civicrm-core.git More accurate dialog size calculations --- diff --git a/js/Common.js b/js/Common.js index d24689ebe5..1a614e3e41 100644 --- a/js/Common.js +++ b/js/Common.js @@ -551,12 +551,12 @@ CRM.strings = CRM.strings || {}; $el.dialog('option', $el.data('origSize')); $el.data('origSize', null); } else { + var menuHeight = $('#civicrm-menu').outerHeight(); $el.data('origSize', { - position: {my: 'center', at: 'center', of: window}, + position: {my: 'center', at: 'center center+' + (menuHeight / 2), of: window}, width: $el.dialog('option', 'width'), height: $el.dialog('option', 'height') }); - var menuHeight = $('#civicrm-menu').height(); $el.dialog('option', {width: '100%', height: ($(window).height() - menuHeight), position: {my: "top", at: "top+"+menuHeight, of: window}}); } e.preventDefault(); diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 0f1cad9242..2dbcdb738f 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -314,10 +314,10 @@ } // Adjust height to fit content (small delay to allow elements to render) window.setTimeout(function() { - var currentHeight = $(settings.target).parent().height(), + var currentHeight = $(settings.target).parent().outerHeight(), padding = currentHeight - $(settings.target).height(), newHeight = $(settings.target).prop('scrollHeight') + padding, - menuHeight = $('#civicrm-menu').height(), + menuHeight = $('#civicrm-menu').outerHeight(), maxHeight = $(window).height() - menuHeight; newHeight = newHeight > maxHeight ? maxHeight : newHeight; if (newHeight > (currentHeight + 15)) {