Replace ajax-loader with Font Awsome spinner
-
It can be marked as resolved.
I’ve done this, so I am sharing with other.
First, be shure Font Awsome is on your site.How to Replace original ajax-loader with Font Awsome icon spinner after Sending button is clicked.
CSS:
/* hide original loader */ div.wpcf7 img.ajax-loader { display: none; } /* style for custom loader '1s' for speeding up animation */ i.fa.fa-refresh.fa-spin.ajax-loader-cusom { -webkit-animation: fa-spin 1s infinite linear; animation: fa-spin 1s infinite linear; }
JS:
// Adding Font Awsome spinner, hidden by default $('img.ajax-loader').after('<i class="fa fa-refresh fa-spin ajax-loader-cusom" style="visibility: hidden"></i>'); // Show new spinner on Send button click $('.wpcf7-submit').on('click', function () { $('.ajax-loader-cusom').css({ visibility: 'visible' }); }); // Hide new spinner on result $('div.wpcf7').on('wpcf7:invalid wpcf7:spam wpcf7:mailsent wpcf7:mailfailed', function () { $('.ajax-loader-cusom').css({ visibility: 'hidden' }); });
Note: change $ to jQuery if you’re not using this code inside
jQuery(document).ready(function ($)
Note 2: if you want to add another Font Awsome icon, be shure to add
ajax-loader-cusom
inside<i class="
needed for targeting on show/hide.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Replace ajax-loader with Font Awsome spinner’ is closed to new replies.