Skip to content

Instantly share code, notes, and snippets.

@asifsomy
Last active February 10, 2018 06:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asifsomy/e6c13cdb5cae1118d486 to your computer and use it in GitHub Desktop.
Save asifsomy/e6c13cdb5cae1118d486 to your computer and use it in GitHub Desktop.
Contact from 7 On Submit, Invalid, Spam, MailSent, Mail Failed JS triggers
div.wpcf7 img.ajax-loader{display:none; margin:5px auto 0;}
$(".wpcf7").on('submit.wpcf', function(e){
$('.form .wpcf7 img.ajax-loader').css('display', 'block');
$('.form .wpcf7 img.ajax-loader').show();
});
$(".wpcf7").on('invalid.wpcf7 spam.wpcf7 mailsent.wpcf7 mailfailed.wpcf7', function(e){
$('.form .wpcf7 img.ajax-loader').hide();
});
$(".wpcf7").on('invalid.wpcf7',function(e){
$('html, body').animate({
scrollTop: $(".wpcf7-not-valid").first().offset().top-30
}, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment