From: Coleman Watts Date: Wed, 22 Oct 2014 13:16:17 +0000 (-0400) Subject: CRM-15507 - Increase dialog percent width on small screens X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f701800d23af9dc4dda44ae1c1463f51b1fc4786;p=civicrm-core.git CRM-15507 - Increase dialog percent width on small screens --- diff --git a/js/crm.ajax.js b/js/crm.ajax.js index a5b4e8c87e..cb9553dd60 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -311,6 +311,18 @@ if (typeof settings.dialog.height === 'string' && settings.dialog.height.indexOf('%') > 0) { settings.dialog.height = parseInt($(window).height() * (parseFloat(settings.dialog.height)/100), 10); } + // Increase percent width on small screens + if (typeof settings.dialog.width === 'string' && settings.dialog.width.indexOf('%') > 0) { + var screenWidth = $(window).width(), + percentage = parseInt(settings.dialog.width.replace('%', ''), 10), + gap = 100-percentage; + if (screenWidth < 701) { + settings.dialog.width = '100%'; + } + else if (screenWidth < 1400) { + settings.dialog.width = '' + parseInt(percentage+gap-((screenWidth - 700)/7*(gap)/100), 10) + '%'; + } + } $('
' + ts('Loading') + '...
').dialog(settings.dialog); $(settings.target) .on('dialogclose', function() {