5

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

JNYRanger
  • 6,829
  • 12
  • 53
  • 81
mheavers
  • 29,530
  • 58
  • 194
  • 315

1 Answers1

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.

karim79
  • 339,989
  • 67
  • 413
  • 406