最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jquery scrollTo not working - Stack Overflow

programmeradmin2浏览0评论

I'm just trying to scroll to a specific DOM element or absolute position in my browser window, and it's not working. Here's my code:

$(window)._scrollable();
$('#scene_01_down').click(function(){
    $(window).scrollTo(2000,1000);
});

and here's the documentation for the plugin:

.html

I'm just trying to scroll to a specific DOM element or absolute position in my browser window, and it's not working. Here's my code:

$(window)._scrollable();
$('#scene_01_down').click(function(){
    $(window).scrollTo(2000,1000);
});

and here's the documentation for the plugin:

http://flesler.blogspot.com/2007/10/jqueryscrollto.html

Share Improve this question edited Sep 21, 2015 at 13:42 JNYRanger 7,09712 gold badges54 silver badges84 bronze badges asked Aug 31, 2012 at 14:49 mheaversmheavers 30.2k62 gold badges198 silver badges326 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 22

Do you really need that plugin?

$("html,body").animate({
    scrollTop: 2000,
    scrollLeft: 1000
});

To scroll to a particular element:

var offset = $("#someElement").offset();
$("html,body").animate({
    scrollTop: offset.top,
    scrollLeft: offset.left
});

Demo.

发布评论

评论列表(0)

  1. 暂无评论