0
爲什麼懸停的Animate.css動畫不能在初始頁面加載動畫之後工作?Animate.css不支持懸停
$(document).ready(function(){
$("h1").addClass("animated zoomInDown")
$("h1").hover(function(){
$(this).addClass('animated shake');
});
爲什麼懸停的Animate.css動畫不能在初始頁面加載動畫之後工作?Animate.css不支持懸停
$(document).ready(function(){
$("h1").addClass("animated zoomInDown")
$("h1").hover(function(){
$(this).addClass('animated shake');
});
如果您使用hover()
請確保您有兩個懸停在和懸停出事件處理程序。如果它刪除CSS動畫只會重新運行,然後再補充說:
$(document).ready(function() {
$("h1").addClass("animated zoomInDown")
$("h1").hover(function() {
$(this).addClass('animated shake');
}, function() {
$(this).removeClass('animated shake');
});
});
h1 {
background: yellow;
position: relative;
}
.animated {
animation: animate-color 0.2s linear;
animation-iteration-count: 5;
}
@keyframes animate-color {
0% {
left: 0;
}
50% {
left: 5px;
background: red;
}
100% {
left: 0px;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>Hello</h1>
但是,這是部分正確也沒有了'$(「H1」)addClass(「動畫zoomInDown 「)'當頁面加載時的動畫@AVAVT – user3519870
@ user3519870你能提供你的環境(瀏覽器/設備)嗎?我在這裏測試了Chrome和Firefox,並且動畫第一次運行良好。 – AVAVT