Connecting Tech Pros Worldwide Help | Site Map

How can i auto scroll down a css iframe ? (overflow:auto;)

Newbie
 
Join Date: Dec 2007
Posts: 2
#1: Dec 9 '07
Hi everyone..!! i have a chat and i want all the new messages to be seen but ecause i have a css iframe i would like to auto scroll down. so i can see the new message instead of click the scroller and scroll down.. it takes time . and i dont really like that idea.. Does some one knows how to do that ?

tachiracompras.com/chat/ see the actual chat.
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,561
#2: Dec 9 '07

re: How can i auto scroll down a css iframe ? (overflow:auto;)


html/css cannot do this
Newbie
 
Join Date: Aug 2009
Posts: 1
#3: Aug 29 '09

re: How can i auto scroll down a css iframe ? (overflow:auto;)


You can do it pretty easily with javascript, nothing fancy:

<script type="text/javascript">
document.getElementById("chatWindowId").scrollTop= 500;
</script>

Just replace chatWindowId with the actual id of you chat window. The element has to be scrollable (overflow-y: auto;). 500 is what I found useful for me, if you want to scroll more, chose one value that suits you. Check also the online documentation for scrollTop, to learn more.
Reply


Similar HTML / CSS bytes