开发者

Scroll smoothly to specific position using jQuery

How can I scroll smoothly to specific positi开发者_运维技巧on using jQuery ?

I could scroll to top smoothly using jQuery with this code :

$("#id").animate({"scrollTop": $("#id").scrollTop() + 100});

But now I want to scroll to position for example 200 of a page.


try this:

$('html, body').animate({scrollTop: 200}, "slow"); //you can change "slow" to a number amount or remove it (default is 500)

jsfiddle: http://jsfiddle.net/UPRkm/


i think you can do it by height....

$("#id").animate({

 height: '200px'

});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜