var targetDiv = $('body');
$(window).scroll(function() {
var windowpos = $(window).scrollTop();
if( windowpos >= 50 ) {
targetDiv.addClass('active');
} else {
targetDiv.removeClass('active');
}
});