When the top of the body window is greater than or equal to the h2 tag, fade the h2 out, if the top of the window goes back up above that h2, fade that h2 back in.
This code will fade out each individual h2 as you pass it scrolling down, but when i scroll back up, it wont fade it back in, and i'm not sure what i'm doing wrong. i'm not the best at jquery. any help is very appreciated.
$(window).scroll(function() {
$('.grid_12').find('h2').each(function () {
if ($(this).offset().top <= $('body').scrollTop()) {
$(this).fadeOut(500)
} else if
($(this).offset().top >= $('body').scrollTop()) {
$(this).prev().fadeIn(500)
}
});
});