The solution: Scroll if element is not visible
shows how to scroll to see a component using jQuery. Is there a portable way to do that directly, or is it different per browser and therefore jQuery is the only way?
The solution: Scroll if element is not visible
shows how to scroll to see a component using jQuery. Is there a portable way to do that directly, or is it different per browser and therefore jQuery is the only way?
Most of the old functions which weren't been deprecated are supported by a very large panel of browsers (at least the browsers used by 99.99% of the internet users). You can check the method scrollTo() and provide x and y coordonates as argument.
Ex : window.scrollTo(500, 100);
Here the compatiblity is OK with Firefox, IE, Safari, Chrome and Opera.
Source : http://www.w3schools.com/jsref/met_win_scrollto.asp
Of course, I advise the use of jQuery for these kinds of actions but it can be made without it with not any problem. As @Jackson noticed, speaking about animation, you'll have hard time to animate your scrolling with raw javascript though.