$(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(); if(day < 7) selectDay(day); else deselectDays(); var dates = getDates(day); // var dates = [45, 53, 53, 23, 53, 64]; $(".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"); } }); function range(start, num, step){ var list= []; var val = start; for(var i = 0; i