$(document).ready(function(){ $(window).scroll(function(){ if ($(window).scrollTop() >= 220) { $(".schedule table thead").addClass("fix animated fadeInDown"); $(".schedule table tbody").addClass("fix"); }else{ $(".schedule table thead").removeClass("fix animated fadeInDown"); $(".schedule table tbody").removeClass("fix"); } }); var now = new Date(); var day = now.getDay(); // day = 3; if(day == 0) deselectDays(); else selectDay(day); var dates = getDates(day); $(".schedule thead .date").each(function(index, elem){ $(elem).text(dates[index]); }); function selectDay(day){ deselectDays(); // day = Math.min(1, day); // day = Math.max(6, day); $($(".schedule thead th")[day]).addClass("current first"); $(".schedule tbody tr").each(function(index, elem){ $($(elem).find("td")[day]).addClass("current"); }); $($(".schedule tbody tr").last().find("td")[day]).addClass("last"); } function deselectDays(){ $(".schedule thead th").removeClass("current first"); $(".schedule tbody td").removeClass("current last"); } }); /** * Generates list of numbers * @param {Number} start starting value * @param {Number} num amount of numbers in list * @param {Number} step difference value * @return {Array} list of numbers */ function range(start, num, step){ var list= []; var val = start; for(var i = 0; i