I have a table, with overflow:auto set.
There is an overabundance of text in one of the TD's, and it displays the vertical scrollbar (as intended).
However, I wonder if there is a way to scroll to the bottom of the td by default, whether via css or javascript.
Any ideas?
Table scroll bar control?
Moderator: General Moderators
I've never tried it with a page element, but you could look into using the scrollTo method.
it might only work with 'window'...but would be worth a try to do something like:
it might only work with 'window'...but would be worth a try to do something like:
Code: Select all
document.getElementById('someElement').scrollTo(x,y);- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Using the write_r() function I wrote a found this.... in Opera at least since FF ground to halt doing the recursion.
A DIV has these properties which match the word "scroll":
[scrollHeight] => 34
[scrollLeft] => 0
[scrollTop] => 0
[scrollWidth] => 1010
[scrollIntoView] => function scrollIntoView() { [native code] }
So it looks like it can be done
A DIV has these properties which match the word "scroll":
[scrollHeight] => 34
[scrollLeft] => 0
[scrollTop] => 0
[scrollWidth] => 1010
[scrollIntoView] => function scrollIntoView() { [native code] }
So it looks like it can be done
ahh yes...the ole scrollIntoView()...that's exactly what you need....good work d11. You'll probably need to just create a temporary element and scroll that into view.
Something like this should work:
I've done it before so I know it works... I just cant' remember where 
Something like this should work:
Code: Select all
var temp = document.createElement("div");
document.getElementById('myScrollingTable').appendChild(temp);
temp.scrollIntoView();