2
페이지에 애니메이션으로 표시 할 요소가 있지만 애니메이션이 적용된 후에 클래스에 변경 사항을 적용하여 애니메이션을 CSS로 연기하고 싶습니다. .. Velocity가 style=
태그의 모든 애니메이션 속성을 남겨두고 CSS 전환을 불가능하게한다는 것을 알았습니다. 그것을 할 수있는 더 좋은 방법이 있다면 내가 아래 솔루션,하지만 전체가 불확실 것 같습니다에 CSS를 재설정이Velocity.js 애니메이션 후 기본값 지우기
, 궁금 해서요?
// first use CSS to hide the element and squish it
$el.css({
width: 0,
left: "-10px",
opacity: 0,
marginRight: 0,
transition: "none"
})
// now animate the width and margin (do this first
// so there's a little gap between existing elements
// before we fade in new element.
.velocity({
width: width,
marginRight: margin
}, {
queue: false,
duration: 230
})
// then fade and move in the new element,
// but this is the iffy bit when it completes
// I have to unset all the styles I've animated?
.velocity({
left: 0,
opacity: 1
}, {
queue: false,
duration: 100,
delay: 130,
complete: function(els) {
$(els).css({
width: "",
left: "",
opacity: "",
marginRight: "",
transition: ""
});
}
});
고맙습니다. 실행하십시오. :) - 나는 당신의 대답에 기초하여 그것을 다시 고려할 것이라고 생각한다. :) –
아마, 더 깨끗한 접근법은 $ (els) .removeAttr ("style")을 사용할 것이다. 고려해야 할 측면은 JQuery의 .css() 메소드가 도달 할 수없는 애니메이션 CSS 요소입니다. 그런 다음 Velocity의 'hook'방법을 참조하십시오. –