Jquery is element in view scroll function

Checks if the element is in view and if it is it fires

	function isScrolledIntoView(el) {
	    var elemTop = el.getBoundingClientRect().top;
	    var elemBottom = el.getBoundingClientRect().bottom;
	 
	    var isVisible = (elemTop >= 0) && (elemBottom <= window.innerHeight);
	    return isVisible;
	}
	
	$(window).scroll(function (event) {
		$( ".view_box" ).each(function( index ) {
		    if (isScrolledIntoView(this)) {
		        $(this).parent().addClass('in_view');
		    }
		});	    
	});
Comments