I have the font awesome refresh icon on the webpage I'm working on.
<i class="fa fa-refresh fa-3x" id="lock-refresh"></i>
When this icon is clicked, I want it to start spinning. I was able to accomplish this by typing the following in my JavaScript file:
$( '#lock-refresh' ).click(function() { $( this ).addClass( 'fa-spin' ).
I only need this icon to rotate for a couple of seconds. I tried adding this (below) to my JS file, but when I do, the icon does not rotate at all:
$( '#lock-refresh' ).click(function() { $( this ).addClass( 'fa-spin' );
I also tried the following, which also does not work:
$( '#lock-refresh' ).click(function() { $( this ).addClass( 'fa-spin' ).delay(1000).removeClass( 'fa-spin' ); startup(); });
I also tried the following, but when I do this, the icon starts spinning, but does not stop:
$( '#lock-refresh' ).click(function() { $( this ).addClass( 'fa-spin' );
I tried all of the above without my startup() function, and it gives the same results, so I'm sure this is not a function.
How do I return the FA refresh icon in just a second or two and then stop?
source share