Reputation:
Am I doing anything wrong that my simple animate does not work?
$('#my_btn').click(function(){
alert('clicked');
$("#my_txt").animate({left:'350px'});
});
Thanks
Upvotes: 0
Views: 33
Reputation: 35973
left is for element in position absolute. you can use marginLeft like this:
$('#my_btn').click(function(){
alert('clicked');
$("#my_txt").animate({marginLeft:'350px'});
});
or set position:absolute
to your span like this to use left
in animate:
CSS
#my_txt{
position:absolute;
}
jQuery
$('#my_btn').click(function(){
alert('clicked');
$("#my_txt").animate({left:'350px'});
});
Upvotes: 0