How to make a div roll with the page?

Friday, July 11, 2014

So, I want to roll the "div_left_bar" with the page, but not from the beginning. I want it to roll after passing through "div_content". Can I do this without javascript? And how could I do it? The div left_bar is rolling with the page, but I want it to happen just when the scroll passes through the point that div_content starts. How could this work? Thanks in advance.



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Example</title>
<style type="text/css">

body{
margin:0px;
padding:0px;


}

#div_header {
background-color:#0000ff;
width:100%;
height:20%;
padding:0px;
margin:0px;
}


#div_footer{
background-color:#ffff00;
width:100%;
height:20%;
position:relative;
top:30%;


}

#div_content{
background-color:green;
width:70%;
height:160%;
position:relative;
top:10%;
left:17%;


}

#div_left_bar{
background-color:orange;
width:5%;
height:50%;
position:fixed;
top:10%;



}

</style>
</head>

<body>

<div id="div_header">
</div>

<div id="div_left_bar">
</div>

<div id="div_content">
<p>Lorem ipsum dolor sit amet...</p>
</div>

<div id="div_footer">
</div>

</body>
</html> `






http://ift.tt/1r3SV0A