Refactor modal to use flexbox instead of JS for positioning
This commit is contained in:
@@ -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 () {
|
||||
|
Reference in New Issue
Block a user