I'm not sure if this can be done using pure CSS or if I need to use some jQuery for this.
I have a div (product_image), which in its current state is located at a distance of about 400 pixels from the top and located relatives, so it clears the top menu and title, what I need to do when the user scrolls down and reaches about 20 pixels from the top of the div I need the div to commit.
Here is what I tried, I have a main div with relative positioning, then I have another div that wraps everything inside with fixed positioning. The problem is that the div remains at 400px on top.
Here is the code:
<div class="product_image">
<div class="product_image_fixed">
<a href="products/1.jpg" class="zoom" title="A bed!" rel="gal1">
<img src="products/1.jpg" width="450" alt="" title="A bed!">
</a>
<ul id="thumblist" class="clearfix" >
<li><a class="zoomThumbActive" href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: 'products/1.jpg',largeimage: 'products/1.jpg'}"><img src='products/1.jpg' width="150" height="100"></a></li>
<li><a href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: 'products/1a.jpg',largeimage: 'products/1a.jpg'}"><img src='products/1a.jpg' width="150" height="100"></a></li> </ul>
</div>
</div>
And CSS
.product_image {
position: relative;
float: left;
width: 450px;
margin-left: 10px;
margin-top: 10px;
}
.product_image_fixed {
position: fixed;
float: left;
}
, , , !