When my page loads, I hide the icon-refresh + icon-spin
icon by setting its display
property to none.
Now, after some action is performed, I wish to display this icon. I invoke jQuery's .show()
method on the icon. However, while the icon is shown, the icon is not spinning anymore.
If I load it without hiding it initially, it spins. But not when it is hidden and displayed later.
EDIT: If it was not clear from the title, I am using Font Awesome to display the icons
Use the fa-spin class to get any icon to rotate, and use fa-pulse to have it rotate with eight steps. This works especially well with fa-spinner & everything in the spinner icons category.
Double check that you don't have AdBlock Plus or uBlock enabled. They might be blocking some of the icons. If you are using IE8, are you using a HTML5 Shim? If this doesn't work, there are further Troubleshooting Ideas on the Font Awesome Wiki.
aria-hidden="true" attribute. Provide a text alternative inside a <span> (or similar) element. Also include appropriate CSS to visually hide the element while keeping it accessible to assisitive technologies. title attribute on the icon to provide a tooltip for sighted mouse users.
Font Awesome is fully open source and is GPL friendly. You can use it for commercial projects, open source projects, or really just about whatever you want.
You have to use $element.css("display","inline-block");
instead of .show();
Old topic, but I had similar issue with "fa-spin" not working after the containing element was hidden with { visibility: hidden }, set with jQuery. There was also some other animation involve, which was probably causing timing issues, etc.
The fix was to set an event on the containing element to fire on making it visible again, which fired this function:
ply_obj.container.on(
'controlsshown',
function () {
if (ply_obj.config.loop_tf) {
ply_obj.loop_icon.removeClass('fa-spin');
setTimeout(function () { ply_obj.loop_icon.addClass('fa-spin'); }, 100);
}
}
);
So removing the "fa-spin", then adding it back with a small delay made it work as desired for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With