Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I make a stack of div's fixed until the 1 before it has completely left the browser window?
    primarykey
    data
    text
    <p>Really sorry about my poorly worded title but I don't know how to explain my question. </p> <p><p>I am making myself a portfolio website which has 4 main sections, profile cover, bio, websites and photography. Currently I have each div stacked on top of one another in a basic website layout. Instead of having the user scroll down the page looking at each section as one long list I would like to make the page seem layered. Once the user has reached the end of section 1 for example section 2 has a fixed position until section 1 has completely left the browser window. The best example of what I'm trying to ask for has been done by <a href="http://www.voxmedia.com/" rel="nofollow">Vox Media</a>.</p> <p>Here is some sample html and css so you get an idea of the properties:</p> <pre><code>body, html { width: 100%; height: 100%; } .div1 { width: 100%; height: 100%; background-color: yellow; padding-top: 300px; } .div2 { width: 100%; height: 1800px; background-color: red; padding-top: 300px; } .div3 { width: 100%; height: 2400px; background-color: blue; padding-top: 300px; } .div4 { width: 100%; height: 100%; background-color: green; padding-top: 300px; } &lt;div class="div1"&gt;&lt;h1&gt;Profile Cover&lt;/h1&gt;&lt;/div&gt; &lt;div class="div2"&gt;&lt;h1&gt;Bio&lt;/h1&gt;&lt;/div&gt; &lt;div class="div3"&gt;&lt;h1&gt;Websites&lt;/h1&gt;&lt;/div&gt; &lt;div class="div4"&gt;&lt;h1&gt;Photography&lt;/h1&gt;&lt;/div&gt; </code></pre> <p>I haven't written any JS to go along with the HTML and CSS because I don't know what to type.</p> <p>First time using this forum so I apologise if I have missed out on some settings or features to help you answer my question. Thanks in advance, Matt.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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