Refactor modal to use flexbox instead of JS for positioning

This commit is contained in:
Ján Mikláš
2018-12-06 20:57:57 +01:00
parent 182e5c0139
commit 6429f7a689
2 changed files with 4 additions and 22 deletions

View File

@@ -346,22 +346,8 @@ define('modal', ['mailpoet', 'jquery'],
return this;
},
setPosition: function () {
var screenWidth;
var screenHeight;
var modalWidth;
var modalHeight;
switch (this.options.type) {
case 'popup':
screenWidth = jQuery(window).width();
screenHeight = jQuery(window).height();
modalWidth = jQuery('.mailpoet_' + this.options.type + '_wrapper').width();
modalHeight = jQuery('.mailpoet_' + this.options.type + '_wrapper').height();
// set position of popup depending on screen dimensions.
jQuery('#mailpoet_popup').css({
top: Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2), 10)),
left: Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2), 10))
});
break;
case 'panel':
setTimeout(function () {