3
我想在第二次單擊按鈕時重複@keyframne動畫,但它只是一次。如何在第二次單擊按鈕時重複@keyframes?
<script>
$(document).ready(function(){
$('#btn_commit').click(function(){
$('#div_msg').css({"animation": "social-notices 4s"});
});
});
</script>
<style>
@-webkit-keyframes social-notices{
17% { left: 10px; opacity: 1; }
83% { left: 10px; opacity: 1; }
100% { left: 10px; opacity: 0; }
}
@keyframes social-notices{
17% { left: 10px; opacity: 1; }
83% { left: 10px; opacity: 1; }
100% { left: 10px; opacity: 0; }
}
#div_msg{
position: absolute;
width: 300px;
height: 40px;
background-color: #c91f37;
color: #ffffff;
border-radius: 4px;
transition: 0.2s ease 0s;
cursor: pointer;
transition-duration: 0.2s;
left: -310px;
}
</style>
我該如何解決這個問題?