I've been using thisJQuery code to fade in divs (all of the same class .showme)
But what I would like to do is fade out the previous div as the next one fades in.
Can anyone offer assistance on this?
$(document).ready(function() {
/* Every time the window is scrolled ... */
$(window).scroll( function(){
/* Check the location of each desired element */
$('.showme').each( function(i){
var middle_of_object = $(this).position().top + $(this).outerHeight() / 2;
var middle_of_window = $(window).scrollTop() + $(window).height() /2;
/* If the object is completely visible in the window, fade it it */
if( middle_of_window >= middle_of_object ){
$(this).animate({'opacity':'1'},2000);
}
});
});
});