tags:

views:

82

answers:

1

Hello,

I have implemented a chat script which requires an absolutely positioned DIV to be wrapped around the pages content.

This is to ensure the chat windows stay at the bottom.

The problem is that because of the absolute positioning of this main wrapper, all other absolutely positioned elements (eg. Jquery Auto-completes, datepicker's etc) now scroll up and down with the page.

Here is an example of the HTML:

<body>
<div id="main_container">
    <div id="content">Elements like Jquery Autocompletes, Datepickers with absolute positioned elements in here</div>
</div>

The DIV "main_container" style looks like this:

#main_container {
    width:100%;
    background-color:#ffffff; /* DO NOT REMOVE THIS; or you'll have issue w/ the scrollbar, when the mouse pointer is on a white space */
    overflow-x: hidden;
    overflow-y: scroll;
    height:100%;    /* this will make sure that the height will extend at the bottom */
    position:absolute; /* container div must be absolute, for our fixed bar to work */
}

I hope there is a simple fix as the chat script is too good to get rid of.

Thanks,

Tim

A: 
  1. You are probably better off making what you want to stay in a fixed position relative to the viewport, position:fixed;.
  2. The background colour seems like a bad hack.
  3. You can make the sorrounding element (main) position:relative without giving it top/left/right/bottom properties and each "fixed" element within, position:absolute, as they will now be relative to the parent which has position:relative.
  4. If none of these work, post more code, especially for the positioning of your "elements that scroll up and down with the page". It's also unclear what you mean with "page". Body? Html? Viewport? main's contents?
Henrik
Ok, I just changed the positioning to relative. Everything seems to still be working just great! I need to test for more bugs but thanks for answering!
Tim