I'm looking for ideas to hide a div when it reaches another div and show it again when it passes the same div. There can also be multiple divs to pass. Something like:
var bottom = $('.out-of-grid-images')
$(window).scroll(function(){
if ($(this).scrollTop() > bottom){
$('.share-icons').fadeOut(200); // hide share icons when reached and overlaps
}
else if ($(this).scrollTop() < bottom){ {
$('.share-icons').fadeIn(200); // show icons when passed element
}
});
I can not produce a jsFiddle because I haven't found anything similar to work with. Any ideas?
EDIT:
The share icons are a fixed position element. The elements reached are dynamic and not fixed from top of the page (they are post content images out of the grid)