Reputation: 3611
i dont know what is wrong with this code.. it will just don't work even if it has the same syntax with the other one..
$(document).ready(function(){
$("#inner").animate({height:'200',top:'-100'},1000);
$("#inner").animate({width:'200',margin-left:'-100'},1000);
});
you can see the example here..
Upvotes: 0
Views: 110
Reputation: 35266
Try giving without px $("#inner").animate({width:'200',margin-left:'-250'},1000);
Or Look at this question on SO
It says,
try using "marginTop" instead of "margin-top". Normally when you use the CSS props as "border-something" or "margin-something" is better to use the "normalized" version of it, as you used to do it in DHTML (styles.marginTop).
So change it to,
$("#inner").animate({width:'200',marginLeft:'-250'},1000);
Or
you can also use redsquare's answer...
Upvotes: 0
Reputation: 78677
You need to quote the margin-left attribute since the hyphen is a reserved js operator.
See update to your demo
Try
$(document).ready(function(){
$("#inner").animate({height:'200',top:'-100'},1000);
$("#inner").animate({width:'200','margin-left':'-100'},1000);
});
Upvotes: 1