gpt4 book ai didi

javascript - 在悬停时旋转 Font Awesome 图标

转载 作者:太空狗 更新时间:2023-10-29 16:52:24 25 4
gpt4 key购买 nike

我正在尝试在悬停时旋转 Font Awesome 刷新图标。

这是普通版:
<i class="fa fa-refresh"></i>

这是旋转版本:
<i class="fa fa-refresh fa-spin"></i>

我只想在悬停时旋转图标。

这是失败的:fiddle

.fa-spin-hover:hover {
-webkit-animation: spin 2s;
-moz-animation: spin 2s;
-o-animation: spin 2s;
animation: spin 2s;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>

<i class="fa fa-refresh fa-2x fa-spin-hover"></i>

最佳答案

使用以下 CSS。希望这对您有所帮助。

.fa.fa-refresh:hover {  
transform: rotate(180deg);
}
.fa.fa-refresh {
transition: transform 0.5s ease 0s;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>

<i class="fa fa-refresh fa-2x fa-spin-hover"></i>

更新 fiddle :http://jsfiddle.net/azim101/Xw7LH/177/

更新:

希望这能满足您的需求。

.fa.fa-refresh:hover {  
-webkit-animation: infinite-spinning 1s ease-out 0s infinite normal;
animation: infinite-spinning 1s ease-out 0s infinite normal;
}

@keyframes infinite-spinning {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<i class="fa fa-refresh fa-2x fa-spin-hover"></i>

关于javascript - 在悬停时旋转 Font Awesome 图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34378940/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com