0
基本上我想通過每5秒添加一個類.anim
來轉換我的元素,但重置它過1秒沒有轉換屬性。CSS:轉換一次轉換,然後重置它,無需轉換
我想要的效果是每5秒鐘旋轉一次箭頭。
這樣做的最好方法是什麼?
setInterval(function(){
var $el = $("a.inbox");
$el.addClass('anim');
setTimeout(function(){
$el.removeClass('anim');
}, 1000);
console.log($el);
}, 5000);
a.inbox:before {
content: '⇧';
display: inline-block;
position: relative;
-webkit-transform: rotate(180deg);
margin-left: 5px;
transition: -webkit-transform 1s;
}
a.inbox {
&.anim:before {
-webkit-transform: rotate(540deg);
}
}
<a href="#" class="inbox">Inbox</a>
我不關注。 – chovy