Note that there are some explanatory texts on larger screens.

plurals
  1. POFixed Position window scrolling issue
    primarykey
    data
    text
    <p>So I have a page layout that has a main content container div that is position relative. With in this container I have two other layout divs, one acting as a side bar the other acting as a content container that can scroll up and down. This div also has a heading bar that must remain in place when you scroll through this div. If I fix the position the heading bar it will stay in place with out a problem as long as you scroll with in that container. If you scroll the entire window though (outside the wrapper div) the header bar scrolls along with it. I know why this is happening but would like to know if there is a way to fix it or prevent this behavior. I do not mind using Javascript to do so either. I understand that that fixed positioning only makes the element fixed to its parent container. </p> <p>This is most likely hard to understand at least lay out wise through just text so here is a very simple example fiddle of just some mark up showing which items are fixed and how they are sort of laid out. <a href="http://jsfiddle.net/gvNqv/" rel="nofollow">http://jsfiddle.net/gvNqv/</a> </p> <p>Thanks a bunch for any possible help with this! </p> <p>EDIT: Adding code from fiddle here</p> <pre><code>.maincontent{ position:relative; width:760px; } .sidebar{ float:left; } .stage{ float:right; position:relative; } .headbar{ position:fixed; } </code></pre> <p>​</p> <pre><code>&lt;div class="wrapper"&gt; &lt;div class="mainContent"&gt; &lt;div class="sideBar"&gt;&lt;/div&gt; &lt;div class="stage"&gt; &lt;div class="headbar"&gt;banner text&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;​ enter code here </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload