Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FontAwesome Icons Spin only on mouseover?

In font awesome how can i use this code : <i class="fa fa-spinner fa-spin"></i> work on mouse over only?

like image 711
Vachos Avatar asked Jan 09 '14 20:01

Vachos


People also ask

How do I rotate Font Awesome 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.

Can you animate Font Awesome icons?

Sure! It doesn't matter if it's a font icon or an SVG icon, you can still animate the element with CSS.

How do I fix Font Awesome icons not showing?

If you installed the Free Font Awesome version but try adding Pro icons to your web pages, they won't show. The solution to this is either you use the alternative free icons or upgrade to a Pro subscription/license.

How do I make Font Awesome icons accessible?

If an icon is not an interactive element The simplest way to provide a text alternative is to use the aria-hidden="true" attribute on the icon and to include the text with an additional element, such as a <span> , with appropriate CSS to visually hide the element while keeping it accessible to assistive technologies.


1 Answers

Instead of overriding the class, you can also just create another one for hover only:

.fa-spin-hover:hover {
  -webkit-animation: spin 2s infinite linear;
  -moz-animation: spin 2s infinite linear;
  -o-animation: spin 2s infinite linear;
  animation: spin 2s infinite linear;
}


<i class="fa fa-circle-o-notch fa-spin-hover"></i>
<i class="fa fa-spinner fa-spin-hover"></i>

Fiddle: http://jsfiddle.net/Xw7LH/1/

Note: if using Font-Awesome 4.2+ you may need to namespace the animation with "fa-":

.fa-spin-hover:hover {
  -webkit-animation: fa-spin 2s infinite linear;
  -moz-animation: fa-spin 2s infinite linear;
  -o-animation: fa-spin 2s infinite linear;
  animation: fa-spin 2s infinite linear;
}
like image 65
Chris Owens Avatar answered Sep 28 '22 06:09

Chris Owens