From c4ec81cc33d648f13241d4fa5f26b3404c7dfc7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ja=CC=81n=20Mikla=CC=81s=CC=8C?= Date: Mon, 21 Sep 2020 14:48:01 +0200 Subject: [PATCH] Fix MailPoet content jumping when modal is shown [MAILPOET-2788] --- assets/js/src/modal.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/js/src/modal.js b/assets/js/src/modal.js index 90871e7aca..d07acebf4f 100644 --- a/assets/js/src/modal.js +++ b/assets/js/src/modal.js @@ -453,16 +453,19 @@ MailPoet.Modal = { return this; }, showOverlay: function () { + var $body = jQuery('body'); + // Used to add space which was took by scrollbar when it's hidden by overflow:hidden + var bodyInnerWidth = $body.innerWidth(); if (!this.options.overlayRender) { return this; } jQuery('#mailpoet_modal_overlay').show(); - jQuery('body').addClass('mailpoet_modal_opened'); + jQuery('body').addClass('mailpoet_modal_opened').css('marginRight', $body.innerWidth() - bodyInnerWidth); return this; }, hideOverlay: function () { jQuery('#mailpoet_modal_overlay').hide(); - jQuery('body').removeClass('mailpoet_modal_opened'); + jQuery('body').removeClass('mailpoet_modal_opened').css('marginRight', 0); return this; }, popup: function (opts) {