Reputation: 8047
I have a centered image and I want to scale it with jquery. The problem is that it scales first and positioned on a second step.
.outer {
width:500px;
height:500px;
background: #f5f5f5;
text-align: center;
}
#inner {
display: none;
}
Upvotes: 0
Views: 52
Reputation: 28437
Why not use keyframes for this? Looks nice, and is hardware accelerated!
http://jsfiddle.net/BramVanroy/omudeaxd/2/
#inner {
width: 0;
height: 0;
animation: zoom 1900ms;
}
@keyframes zoom {
0% {
width: 0;
height: 0;
}
100% {
width: 300px;
height: 300px;
}
}
Upvotes: 0
Reputation: 10665
Use animate()
instead of show()
:
Just replace your js
with this:
$( document ).ready (function () {
$('#inner').css({'height':0,'width':0})
$('#inner').animate({height:300+"px",width:300+"px"},1900)
});
Upvotes: 2