Add Body Class on Scroll

Add a body class when user begins scrolling using jQuery.

(function($){    
	$(document).ready(function(){

          // Add class to body when scrolling to add white background
          var targetDiv = $('body');

          $(window).scroll(function() {

               var windowpos = $(window).scrollTop();

			   // change amount here to choose distance from top to add class
               if( windowpos >= 50 ) {
                    targetDiv.addClass('scrolling-active');
               } else {
                    targetDiv.removeClass('scrolling-active');
               }

          });

    });
})(jQuery);