tzenderman
tzenderman

Reputation: 2663

Scrolling with Javascript inside of an overflow element

I need to do scrolling with JS. I know it can be done on the window with window.scrollBy or window.scrollTo, but I haven't been able to find how to get it done inside of an element that has the overflow-y: scroll css property. Here's a JSBin as an example of what I want to scroll: http://jsbin.com/UcUQul/1/edit

Upvotes: 0

Views: 66

Answers (1)

kamituel
kamituel

Reputation: 35950

You can use scrollTop property. For instance:

var outer = document.getElementById('outer');
outer.scrollTop = 10; 

See this JSFiddle for an example.

Upvotes: 1

Related Questions