What is auto scrolling

broken image
broken image

You'll need to use the offsetTop and offsetParent properties to make the code robust. This doesn't take into account that the DIV might be nested, etc.

broken image
broken image

I simply measure the clientHeight of the DIV element, and tell the browser to scroll to that position. Curabitur tincidunt.įusce est velit, condimentum sed, convallis in, blandit hendrerit, eros. Suspendisse a mi vitae nulla vehicula lacinia. Etiam egestas.ĭonec vitae mauris vitae nisi gravida pharetra. Nullam in odio ac augue porttitor semper. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.ĭonec tristique lectus sit amet est. Here's a simplistic example of scrolling: You can know the size of an element, using it's 'clientHeight' property, for example, and its position on the page, using offsetTop & offsetParent. However, you can scroll the browser window, using the 'scrollTo()' method. You cannot scroll, as far as I know, the inner contents of a DIV element. You have to explain exactly what it is you want. It will scroll to the bottom so you can see what you just added. So, you type something in and click Add Stuff. Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff I'd like to be able to automatically scroll the DIV to the bottom when you add stuff to it. I wrote this little code segment to illustrate the idea of what I want. but it wasn't even remotely in the right spot before.