Forum Moderators: open

Message Too Old, No Replies

Div content scrolling to bottom

         

AndreiIsakov

2:46 pm on Nov 5, 2002 (gmt 0)

10+ Year Member



Hello, everybody!
I have the following problem:
I have a DIV and some content inside the DIV, but content height is more than the DIV height.
I want to automatically scroll the content to the very bottom when the page is loaded.

All scripts I found are extremely complicated. They scroll the content up and down, but I do not really want to scroll

Thanks in advance,
Andrei

tedster

3:19 pm on Nov 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, Andreilsakov.

Have you tried not declaring any height for the div? That way the div should automatically expand to display all the content with no overflow scrolling.

Of course if it's more than a screenful, there will be page scrolling, but there won't be any little "internal" scrollbars just for the div.

AndreiIsakov

9:26 am on Nov 6, 2002 (gmt 0)

10+ Year Member



I want my div to be exactly the 100% of browser client area.
to do this I do the following:

DIV.borderedPanel {margin:0; height:100%; width:100%; overflow:scroll; background-color: <%= backgr.getMainColor() %>; border-style:solid; border-width:2px; border-color: black #E9E9E9 #E9E9E9 black; padding:3}

DIV.leftWrapper {margin:0; padding:3px 2px 3px 4px; height:100%; width:auto; background: transparent; border:none}

<body>
<div class="leftWrapper">
<div class="borderedPanel">
some content
</div>
</div>
</body>

maybe it is better to use iframe instead?

tedster

10:09 am on Nov 6, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I like iframes very much - simplicity.

But I guess I'm missing something. If the div fills the browser area completely, why not just allow the standard browser scrollbar to appear if someone's display requires it?

That is, why introduce the complication of a possible second scrollbar on the screen if the div already goes from top to bottom?

AndreiIsakov

8:37 am on Nov 7, 2002 (gmt 0)

10+ Year Member



Because I want the second frame on the left side. Right frame will contain chat messages, another one will contain list of users. I do not want to make them as separate frames because they must be refreshed all the time.
I think it is better to have one request (with two divs) instead of separate requests for messages and users

tedster

10:50 am on Nov 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah, now I see more clearly.

You need the div to be scrolled to the very bottom of the chat content, so that the most recent messages are always on screen. And the div should also fill the screen top to bottom (but not right to left) so that a maximum amount of chat is visible.

With an iframe you have the use of javascript methods - scrollBy() and scrollTo(), but I can't immediately see how to get the scroll to the bottom of the chat. There was an HTMLElement.scrollIntoView() but that was IE only, I believe.

Looks like we still don't have all the answers you need. Anyone?

SuzyUK

2:00 pm on Nov 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not too sure of the exact way to do this and I don't know enough about javascript to do the same with it, but perhaps someone else could help with this as my method does not work in Opera...

I suggest using an <iframe>, specifying it's width:100% height: 100%, within your content <div> set to width whatever and height:100% ...as Opera does not support the overflow: scroll there is no real advantage to trying to make the div scroll

Then if you make your content page and put:
<META HTTP-EQUIV="Refresh" CONTENT="10; URL=yourchatpage.htm#bottom">
within the head tags of this document and:

<a name="bottom"></a>
below your chat section,

in your calling (main) page have <iframe src="yourchatpage.htm#bottom"> within the content <div>

this works in IE6 and netscape, and still might be a solution for you as it still produces the scrollbars in Opera which will alow users to scroll anyway...and keeps your page to the required height

Suzy