franhaselden
1/26/2015 - 2:34 PM

Add/remove sticky-header when scrolls past a certain point

Add/remove sticky-header when scrolls past a certain point

$(window).on('scroll', function() {
	// Creates sticky header 
    var y_scroll_pos = window.pageYOffset;
    var scroll_pos_test = 290;
    if(y_scroll_pos >= scroll_pos_test) {
    	$("#home-table .head").addClass("sticky-header");
    }else if(y_scroll_pos < 290){
    	$("#home-table .head").removeClass("sticky-header");
    }
});