How to automatically scroll inline div without scrolling the whole page?

I have divas a container to represent the file. This one divhas scrolling in the direction y.

I want to automatically scroll the contents inside this container divto a certain position when the page loads, but without scrolling the entire page. I tried with <a name="scrollHere">and location.hash = 'scrollHere';, but it scrolls the whole page.

Do you have any ideas?

+1
source share
2 answers

Use scrollTop for a container element with a value calculated from the y position of the element inside the container.

Mozilla Element.scrollTop

fooobar.com/questions/1820728 / ...

+3
source

scrollTop , , , . , , .

Ext, Element.scrollIntoView. , , scrollIntoView.

http://www.extjs.com/deploy/dev/docs/source/Element.scroll-more.html#method-Ext.Element-scrollIntoView

0

All Articles