JS: Add Class To Element When X From Top Of The Viewport

The below javascript is used to add a class to an element when it reaches X from the top of the viewport.

var qCont = jQuery('.q-cont').offset().top-250; 

jQuery(window).on( 'scroll', function(){
	if (jQuery(window).scrollTop() >= qCont) {
		jQuery('.track-more-row').addClass('animated fadeInUp');
	}
});

Powered by BetterDocs