119
rated 0 times
[
123]
[
4]
/ answers: 1 / hits: 33600
/ 10 Years ago, thu, october 30, 2014, 12:00:00
<div id=header></div>
<div id=sticky></div>
<div id=section></div>
<div id=footer></div>
<style>
body { margin: 0px; background-color: #e3e3e3; }
#header { background-color: #cb5454; height: 140px; }
#sticky { background-color: #546bcb; height: 70px; }
#section { height: 1500px; }
#footer { background-color: #cb5454; height: 140px; }
</style>
Here is my code: http://jsfiddle.net/uaqh018d/
I want #sticky to stick to the top of the page after scrolling past #header. I also want it hidden until stuck. And then of course have it unstick+hide again after scrolling back up to #header.
How can I achieve this?
More From » jquery