I want to use .appendTo()
to modify the DOM position of an element. Once this is complete I need to animate the element with CSS3.
The element will not animate, instead it snaps to the new CSS style.
JavaScript:
$(".run").click(function() {
$(".imageOriginal").appendTo(".insert").toggleClass("imageAnimated");
});
HTML:
<div class="insert"> </div>
<img src="img/img1.png" class="imageOriginal"/>
CSS:
.imageOriginal {
-webkit-transform: scale(0.1);
}
.imageAnimated {
-webkit-transition: all 1s ease-in-out;
-webkit-transform: scale(1);
}
I separated the the .appendTo()
and the .toggleClass()
methods to fire on two different click events. This method works (but obviously isn't desired). I also tried using .delay(1000)
after the append, but this doesn't work either.