I want to format the posts on a blog to have stacking ‘title divs’ when the user scrolls down the page. The only way for me to explain this was to make a little demo by cheating and using z-index all over the place to simulate how it’s supposed to look.
I want to recreate this effect but make it applicable to posts on a blog. Is this possible?
EDIT: Trying to find a way to create this effect using javascript.
Here’s the current css:
body {
margin: 0;
padding: 0;
}
h2, h3, p {
padding: 0px;
margin: 0px;
}
#container {
position: relative;
width: 360px;
margin: 0px auto;
}
#header {
position: fixed;
top: 0px;
width: 360px;
height: 60px;
background: #fff;
z-index: 10;
}
#right_column {
width: 360px;
margin: 60px 0px 0px 0px;
}
#right_column .first_title {
position: relative;
margin: 0px;
font-size:32px;
line-height: 30px;
z-index: 9;
background: #fff;
}
#right_column .first_fixed {
position: fixed;
top: 60px;
z-index:6;
width: 360px;
background: #eee;
border-top: #999 1px solid;
}
#right_column .first {
position: relative;
z-index: 5;
background: #fff;
}
#right_column .second_title {
position: relative;
margin: 0px;
font-size:32px;
line-height: 30px;
z-index: 5;
background: #fff;
}
#right_column .second_fixed {
width: 360px;
position: fixed;
top: 80px;
z-index: 3;
border-top: #999 1px solid;
background: #eee;
}
#right-column .second {
position: relative;
z-index: 2;
}
Here’s the markup:
<h2 class="first_title">This is the article title.</h2>
<h3 class="first_fixed">This is the article title.</h3>
<p class="first">This is some text.</p>
<h2 class="second_title">This is the article title.</h2>
<h3 class="second_fixed">This is the article title.</h3>
<p class="second">This is some text.</p>
I’m not sure what you are asking for .. I suppose you are trying to have an alternative to the one you already found. In this case you might want to have a look at the jQuery waypoints plugin in this example .. you define markers which trigger events when you scroll the page.
Here its main page