0

I would like you to help me make a Javascript code with autoscroll down in one particular div in one page, and while it scrolls down i want to make one procedure.

Im new in javascript but i know these things to help you out

<div class="uiScrollableAreaWrap scrollable" data-reactid=".c6.0">

This is the div of the box that is scrollable.

Could you give me an example of how can i make a javascript code to take this class and scroll down until the end of the Wrap??

Update one.

http://screencast.com/t/8WNIFZB8rYG

Check out this photo to see all the divs of the box that i want to scroll down.

Konstantinos Natsios
  • 2,874
  • 9
  • 39
  • 74
  • possible duplicate of [Scroll to bottom of div?](http://stackoverflow.com/questions/270612/scroll-to-bottom-of-div) – nicael Mar 21 '15 at 11:08

1 Answers1

-1

Relevant SO Link

Just for your case:

This will scroll down to bottom of the div

var objDiv = document.querySelector("._5tee .uiScrollableAreaWrap");
objDiv.scrollTop = objDiv.scrollHeight;

DEMO

Update:

based on your screenshot, Assuming that you want to scroll the ul list to the bottom.

var ulList= document.querySelector("._5tee .uiScrollableAreaWrap");
ulList.scrollTop = ulList.scrollHeight;

In case you want it for other div, use this pattern

.uiScrollableAreaWrap.scrollable yourdivselector
Community
  • 1
  • 1
mohamedrias
  • 18,326
  • 2
  • 38
  • 47
  • It's quite clear that you slightly adapted code from [there](http://stackoverflow.com/a/270628). Please vote to close instead. – nicael Mar 21 '15 at 11:07
  • This scrolls the main page... maybe i copied the wrong div, wait to edit it – Konstantinos Natsios Mar 21 '15 at 11:08
  • Added link to that page as well @nicael – mohamedrias Mar 21 '15 at 11:09
  • @KwnstantinosNatsios change the selector inside document.querySelector to match your div element. – mohamedrias Mar 21 '15 at 11:10
  • Based on your screenshot, updated @KwnstantinosNatsios – mohamedrias Mar 21 '15 at 11:21
  • ` var objDiv = document.querySelector("._5tee .uiScrollableAreaWrap"); objDiv.scrollTop = objDiv.scrollHeight; ` this works for my case, but i want to make it in a loop cause when i put this code it only does one scroll down and after is loading more contents in the box and then i have to do it again so it can scroll down with the new contents. thanks anyway its a big step. copy paste the code to your answer so i can approve it since you helped me with the main code :) – Konstantinos Natsios Mar 21 '15 at 11:26