开发者

Scroll smoothly to specific position using jQuery

开发者 https://www.devze.com 2023-03-09 21:20 出处:网络
How can I scroll smoothly to specific positi开发者_运维技巧on using jQuery ? I could scroll to top smoothly using jQuery with this code :

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

精彩评论

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

关注公众号