From 28d510ab1574a956b02fab6bf17a4635172d4f2b Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 28 Aug 2014 16:52:34 +0100 Subject: [PATCH] More accurate dialog size calculations --- js/Common.js | 4 ++-- js/crm.ajax.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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)) { -- 2.25.1