저는 도움이 필요합니다. 좀 더 유동적 인 애니메이션을 만들기 위해 jQuery와 함께 css3 애니메이션을 사용하려고합니다. 제 문제점은 애니메이션이 잘 작동하지만 애니메이션이 작동 할 때입니다. 요소가 원래 크기로 되돌아갑니다. 어떻게하면 0px 너비로 애니메이션을 만들고 그 크기로 유지할 수 있습니까? 내 코드는 아래와 같습니다 :jQuery와 CSS3 애니메이션에 대한 도움말
<style>
.element{
width:210px;
height:210px;
background-color:#000;
}
.box {
-webkit-animation-name: BOX;
-webkit-animation-duration: 0.75s;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: ease-in;
}
@-webkit-keyframes BOX {
from {
width: 210px;
}
to {
width: 0px;
}
}
</style>
<html>
<div class="element"></div>
$('.element').click(function(){
$(this).addClass('box');
});
</html>
프로덕션 코드가이 코드와 비슷한 경우 CSS 전환을 사용하는 것이 좋습니다. Opera, Webkit 및 Firefox에서 지원되며 구문이 더 간단합니다. – Duopixel