css の何が問題なのですか?バウンス アニメーションが発生しませんか? 発生していないCSSアニメーションに従って、クリック時に画像をバウンスさせたい
HTML コード::
<div class="hair">
<img src="images/single.png" id="hair1" class="hair_animate" width="13" height="40" onclick="bounce();" >
</div>
CSS コード:
.hair{
position: absolute;
top: 500px;
}
@-webkit-keyframes bounce {
0%, 20%, 50%, 80%, 100% {-webkit-transform: translateY(0);}
40% {-webkit-transform: translateY(-60px);}
60% {-webkit-transform: translateY(-35px);}
}
.bounce_css
{
-webkit-animation-name: bounce;
}
Javascript コード:
function bounce(){
alert("reached")
document.getElementById('hair1').style.WebkitAnimationName = 'bounce_css';
}