Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
137
rated 0 times [  140] [ 3]  / answers: 1 / hits: 27985  / 13 Years ago, mon, june 13, 2011, 12:00:00

For example I have I a div tag with the scroll bar on the right of the div tag.

I want to show the div with the last line, so I have this:



document.getElementById(divscroll).scrollTop = 250000;


I can make it scroll to the end in Firefox but never succcess with IE event with the bigger number!

Is there any simple Cross-borwser script (not JQuery or any big framework!)


More From » scrolltop

 Answers
122

scrollTop works in all major browsers.



To scroll to the bottom of the element:



var div = document.getElementById('divscroll');
div.scrollTop = div.scrollHeight - div.clientHeight;


clientHeight also works across browsers, and scrollHeight mostly works.


[#91741] Friday, June 10, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brandon

Total Points: 393
Total Questions: 106
Total Answers: 106

Location: Aland Islands
Member since Wed, Nov 17, 2021
3 Years ago
;