$('.animate').addClass('');
$(window).scroll(function (event) {
var scroll = $(window).scrollTop();
$('.animated').each( function() {
var offset = $(this).offset();
var topPosition = offset.top - 400;
var InAnime = $(this).data('animation-in');
var OutAnime = $(this).data('animation-out');
if(scroll > topPosition) {
//$$()('.animate').css('margin','20px','display','block');
//.fadeIn(500);
$(this).addClass(InAnime);
$(this).removeClass(OutAnime);
}
if($(this).hasClass(InAnime)) {
if(scroll + 200 < topPosition ) {
$(this).removeClass(InAnime);
$(this).addClass(OutAnime);
//$('.animate').css('margin','150px','display','block');
//.fadeOut(500);
}
}
});
});