xxxxxxxxxx
$(window).scroll(function() {
var winHeight = $(this).height();
var scrollTop = $(this).scrollTop();
var elemHeight = $("#first-section").height();
var elementTop = $("#first-section").position().top;
if (elementTop < scrollTop + winHeight && scrollTop < elementTop + elemHeight)
$("your-div").addclass("active");
else
$("your-div").removeClass("active");
});