Team:Heidelberg/js/notebook
From 2014.igem.org
(Difference between revisions)
Line 13: | Line 13: | ||
} | } | ||
- | updateToTimestamp = function(timestamp) { | + | updateToTimestamp = function(timestamp, updateGraph) { |
var $week = $('#innerWrapper .'+selectedProject).filter(function(){ | var $week = $('#innerWrapper .'+selectedProject).filter(function(){ | ||
return ($(this).data("timestamp") <= timestamp) && (timestamp < $(this).data("timestamp")+604800); | return ($(this).data("timestamp") <= timestamp) && (timestamp < $(this).data("timestamp")+604800); | ||
Line 26: | Line 26: | ||
$('.month').removeClass('active'); | $('.month').removeClass('active'); | ||
$month.addClass('active'); | $month.addClass('active'); | ||
+ | |||
+ | if(updateGraph) | ||
+ | updateGraphToTimestamp(timestamp); | ||
} | } | ||
- | |||
- | |||
$(document).ready(function(){ | $(document).ready(function(){ | ||
Line 43: | Line 44: | ||
}); | }); | ||
+ | $(".month").click(function(){ | ||
+ | updateToTimestamp($(event.target).data("timestamp"), true); | ||
+ | }); | ||
+ | |||
+ | $(".weekentery").click(function() { | ||
+ | updateToTimestamp($(event.target).data("timestamp"), true); | ||
+ | }); | ||
}); | }); |
Revision as of 21:06, 13 October 2014
var projects = {
dnmt1 : "DNMT1 description", lov: "LOV Domain description", lysozyme : "Lysozyme description", standards: "Standards description", toolbox: "Toolbox description"
}
var selectedProject = "dnmt1";
scrollToElement = function(id){ $('#outerWrapper').animate({scrollTop: $('#'+id).offset().top - $('#innerWrapper').offset().top}, 1500, "easeInOutCubic"); }
updateToTimestamp = function(timestamp, updateGraph) {
var $week = $('#innerWrapper .'+selectedProject).filter(function(){ return ($(this).data("timestamp") <= timestamp) && (timestamp < $(this).data("timestamp")+604800); }).first(); $('#innerWrapper .'+selectedProject).removeClass('active'); $('#outerWrapper').stop(true); $week.addClass('active'); $('#outerWrapper').animate({scrollTop: ($week.offset().top - $('#innerWrapper').offset().top)-20}, 1500, "easeInOutCubic"); var $month = $('.month').filter(function(){ return $(this).data("timestamp") <= timestamp; }).last(); $('.month').removeClass('active'); $month.addClass('active');
if(updateGraph) updateGraphToTimestamp(timestamp);
}
$(document).ready(function(){
$(".titles span").click(function(event){ $('.titles span').removeClass("active"); $(event.target).addClass("active"); $('#project-description').html(projects[event.target.id]); selectedProject = event.target.id; console.log(selectedProject); $('#innerWrapper > :not(.'+selectedProject).fadeOut(); $('#innerWrapper > .'+selectedProject).fadeIn(); });
$(".month").click(function(){ updateToTimestamp($(event.target).data("timestamp"), true); });
$(".weekentery").click(function() { updateToTimestamp($(event.target).data("timestamp"), true); });
});