0
我有幾個元素,持續幾秒鐘的動畫。當你將鼠標懸停在其中一個上面時,我希望CSS3動畫暫停並執行某些操作,當懸停彈出時,繼續動畫。如何用jQuery覆蓋CSS3動畫?
下面是一個簡單的例子小提琴,顯示CSS3動畫發生的事情,當你將鼠標懸停在第三棒(帶班。測試),它應該覆蓋CSS:
@keyframes animation {
from { width: 0;}
to {width: 200px;}
}
@-webkit-keyframes animation {
from { width: 0;}
to {width: 100%;}
}
div {
animation: animation 3s;
-webkit-animation: animation 3s;
display:block;
height:50px;
background:red;
margin-bottom:20px;
}
.change {width: 50%;}
$('.test').hover(function() {
$(this).toggleClass('change');
});
任何想法如何做到這一點?
http://jsfiddle.net/Hr7vB/要精確.. +1 – PSL
感謝的人,它幫助我 –