Move style rendering

[MAILPOET-2880]
This commit is contained in:
Pavel Dohnal
2020-05-13 15:03:37 +02:00
committed by Veljko V
parent e26f5318ff
commit 4cbaf975b0
3 changed files with 39 additions and 47 deletions

View File

@@ -46,27 +46,6 @@ jQuery(($) => {
return true;
}
function moveStyle(formDiv) {
const form = formDiv.find('form');
formDiv.data('background-image', form.css('background-image'));
formDiv.css('background-image', form.css('background-image'));
formDiv.css('background-position', form.css('background-position'));
formDiv.css('background-repeat', form.css('background-repeat'));
formDiv.css('background-size', form.css('background-size'));
form.css('background-image', '');
form.css('background-position', '');
form.css('background-repeat', '');
form.css('background-size', '');
}
function checkFormBackground(formDiv) {
if ($(window).width() >= 500) {
formDiv.css('background-image', formDiv.data('background-image'));
} else {
formDiv.css('background-image', '');
}
}
function showForm(formDiv, showOverlay = false) {
const form = formDiv.find('form');
const position = form.data('position');
@@ -108,9 +87,6 @@ jQuery(($) => {
$('.mailpoet_form').each((index, element) => {
$(element).children('.mailpoet_paragraph').last().addClass('last');
});
$('div.mailpoet_form').each((index, element) => {
moveStyle($(element));
});
$('.mailpoet_form_close_icon').click((event) => {
const closeIcon = $(event.target);
const formDiv = closeIcon.parent();
@@ -138,7 +114,6 @@ jQuery(($) => {
// Detect form is placed in tight container
const formDiv = $(element);
checkFormContainer(formDiv.find('form'));
checkFormBackground(formDiv);
});
});