[Javascript] Div overflow autoscroll

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
anto91
Forum Commoner
Posts: 58
Joined: Mon Mar 10, 2008 10:59 am
Location: Sweden

[Javascript] Div overflow autoscroll

Post by anto91 »

hello dudes :mrgreen: i got a problem i have written a chat application using Zend Framework and jQuery

I got the chat container

Code: Select all

 <h2>Chat</h2><p id="warning" style="color:red;">    This page requires javascript to function.<br>    Please enable javascript to join our chat.</p><div id="message-container"></div><div id="message-output">    <input type="text" maxlength="120" size="95" id="message"></div><br><div id="info">    Please rember to not flood the channel.</div> 
And the css

Code: Select all

 
#message-container {
    margin-right:5px;
    border:1px solid #CCC;
    height:400px;
    overflow:auto;
}
 
#message-output {
        margin-right:5px;
    
    padding:5px;
    border-left: 1px solid #CCC;
    border-right: 1px solid #CCC;
    border-bottom: 1px solid #CCC;
}
 
#message-output input {
    border:1px dashed #CCC;
}
 
#message-container p {
    border-bottom:1px dashed #CCC;
    margin:0px;
    padding:5px;
    font-size:15px;
}
 
As you can see that when to many message enter the message-container a scroll is added.
My problem is that i always want the scroll at the bottom of the page.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: [Javascript] Div overflow autoscroll

Post by pickle »

We have a forum for client side stuff. It's called Client-Side :roll: .

Moving thread there.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: [Javascript] Div overflow autoscroll

Post by JAB Creations »

To create a vertical-scroll for an overflow element you must either set the height and width or the positioning of the element that has the overflow property.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Re: [Javascript] Div overflow autoscroll

Post by JellyFish »

Try looking into the scrollHeight, scrollWidth, scrollTopand scrollLeftelement properties.
Post Reply