Connecting Tech Pros Worldwide Forums | Help | Site Map

Manually setting the position of a scrollbar

Newbie
 
Join Date: May 2009
Posts: 30
#1: Jun 26 '09
Hey, I've got an HTML page with several span tags, each of which will gain text as my script runs. I've got them fixed in a box, and overflow set to "auto" so that they'll have a scrollbar when the text can no longer fit.

\I want the scroll bar to move down as far as it can go each time text is added, so that it "follows" the text. My problem is that I'm not sure how to do this. Is there some easy way with Javascript to set the position of the scrollbar?

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,750
#2: Jun 26 '09

re: Manually setting the position of a scrollbar


Yes, use scrollTop.
Newbie
 
Join Date: May 2009
Posts: 30
#3: Jun 26 '09

re: Manually setting the position of a scrollbar


Awesome, it works great now. Thanks.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,750
#4: Jun 28 '09

re: Manually setting the position of a scrollbar


You're welcome :)
Reply

Tags
bar, javascript, scroll, scrollbar