From ea5b03be1d75646947c097afd6d306b446a6b087 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 20 Oct 2017 20:28:00 +0200 Subject: [PATCH] Add code for fading out a table. --- carousel.js | 13 +++++++++++++ score.css | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/carousel.js b/carousel.js index 4263995..e9c2ed8 100644 --- a/carousel.js +++ b/carousel.js @@ -341,6 +341,7 @@ var display_group = function(response, group_name) { carousel.appendChild(footer_tr); fade_in_rows(carousel); + setTimeout(function() { fade_out_rows(carousel); }, 4000); carousel.style.display = 'table'; }; @@ -357,6 +358,18 @@ var fade_in_rows = function(table) } }; +var fade_out_rows = function(table) +{ + var trs = table.getElementsByTagName("tr"); + for (var i = 0; i < trs.length; ++i) { + if (trs[i].className === "footer") { + trs[i].style = "-webkit-animation: fade-out 1.0s ease; -webkit-animation-delay: " + (0.125 * i) + "s; -webkit-animation-fill-mode: both;"; + } else { + trs[i].style = "-webkit-animation: fade-out 1.0s ease; -webkit-animation-delay: " + (0.125 * i) + "s; -webkit-animation-fill-mode: both;"; + } + } +}; + // Stream schedule var display_stream_schedule = function(response, group_name) { var teams = parse_teams_from_spreadsheet(response); diff --git a/score.css b/score.css index 1455117..60febc4 100644 --- a/score.css +++ b/score.css @@ -398,9 +398,17 @@ body { } @-webkit-keyframes fade-in { 0% { - opacity: 0.0001; + opacity: 0; } 100% { opacity: 1; } } +@-webkit-keyframes fade-out { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} -- 2.39.2