contact form 7 massage popups
by avgustre
CSS
div.wpcf7 .ajax-loader {
display: none !important;
}
div.wpcf7-validation-errors,
div.wpcf7-acceptance-missing {
color: red !important;
}
div.wpcf7-response-output {
border: 0 !important;
padding: 0 !important;
}
div.wpcf7-response-output,
div.wpcf7-validation-errors {
display: none !important;
}
span.wpcf7-not-valid-tip {
display: none;
}
/* input[aria-invalid="true"], select[aria-invalid="true"] {
border-color: #ff2c00; background-color: rgba(153,0,0,0.3);
} */
JavaScript
$(".wpcf7-form input[type='submit'], .wpcf7-form button").click(function(event) {
$(document).one("ajaxComplete", function(event, xhr, settings) {
var data = xhr.responseText;
var jsonResponse = JSON.parse(data);
// console.log(jsonResponse);
if (!jsonResponse.hasOwnProperty('into') || $('.wpcf7' + jsonResponse.into).length === 0) return;
// alert(jsonResponse.message);
$.fancybox.open(
'<div class="message recall-form-message">' + jsonResponse.message + '</div>', {
smallBtn: true,
toolbar: false
}
);
});
});