// javascript document $(function(){ $(window).on("scroll",function(){ scrollhandler(); }).scroll(); function scrollhandler(){ var scrolltop=$(window).scrolltop(); var windowheight=$(window).height(); $(".section").each(function(i,dom){ if($(dom).offset().top-scrolltop<=windowheight+350-200){ $(dom).addclass("active"); }; }); } })