From 49ff9cecb6549b50e54c4202841834729555883f Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 22 Dec 2017 13:31:34 +0100 Subject: [PATCH] Added simple click event for course selection --- js/main.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 49d791e..ef1a9fa 100644 --- a/js/main.js +++ b/js/main.js @@ -47,11 +47,16 @@ preprocessor.load(function(data) { var races = processor.getRacesByYear(selectedYear); $("#courseSelection").empty(); for(var race in races) { - $("#courseSelection").append("
  • " + races[race].raceInfo.name +" " + races[race].raceInfo.date + "
  • "); + $("#courseSelection").append("
  • " + races[race].raceInfo.name +" " + races[race].raceInfo.date + "
  • "); } + $("#courseSelection li").click(function(event) { + var race = event.target.attributes.data.value; + $("#lineGraphBox").empty(); + createLineGraph("#lineGraphBox", processor.getRace(race)); + }); slyelement.obj.reload(); var raceData = races[0]; - createLineGraph("#lineGraphBox", processor.getRace(974)); + }); $(window).resize(function(e) {