Reputation: 9221
How to make 2 animate one by one, first execute scrollTop 1500px, after that execute scrollTop -1500px. Thanks.
$(function(){
$('#content').animate({
scrollTop:1500
}, 300, function(){
$('#content').animate({
scrollTop:-1500
}, 300);
});
});
Upvotes: 1
Views: 549
Reputation: 22948
Try taking look at http://api.jquery.com/delay/ this might be what you need.
Upvotes: 1
Reputation: 66389
As far as I know, scrollTop can't have negative value so just use top
instead:
$(function(){
$('#content').animate({
top:1500
}, 300, function(){
$('#content').animate({
top:-1500
}, 300);
});
})
Upvotes: 0