From cc8d952d3994761f159975e68e21620a3015880c Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Fri, 4 Aug 2023 12:27:23 +0200 Subject: [PATCH] fix scroll --- scores/templates/scores/brackets.html | 2 +- scores/templates/scores/ranks.html | 7 +-- scores/templates/scores/teams.html | 7 +-- scores/templates/scores/tournament.html | 65 +++++++++++++------------ 4 files changed, 42 insertions(+), 39 deletions(-) diff --git a/scores/templates/scores/brackets.html b/scores/templates/scores/brackets.html index f13b674..68da90f 100644 --- a/scores/templates/scores/brackets.html +++ b/scores/templates/scores/brackets.html @@ -22,7 +22,7 @@ {% if tv %} + {% endif %} {% if tournament.club.header %} diff --git a/scores/templates/scores/teams.html b/scores/templates/scores/teams.html index 7619319..48b9f89 100644 --- a/scores/templates/scores/teams.html +++ b/scores/templates/scores/teams.html @@ -26,7 +26,7 @@ {% if tv %} + {% endif %} {% if tournament.club.header %} diff --git a/scores/templates/scores/tournament.html b/scores/templates/scores/tournament.html index 3773491..74c052b 100644 --- a/scores/templates/scores/tournament.html +++ b/scores/templates/scores/tournament.html @@ -22,38 +22,39 @@ {% if tv %} + var iInterval = 4000; + var iScrollInterval = 10000; + var iFadeInterval = 500; + var iScroll = $(document).height() - $(window).height(); + + if (iScroll * 10 + 4000 < 15000) { + iScrollInterval = 10000; + } else { + iScrollInterval = iScroll * 10; + } + + var loop = function() { + var iScroll = $(document).height() - $(window).height(); + if (iScroll * 10 + 4000 < 15000) { + iScrollInterval = 10000; + } else { + iScrollInterval = iScroll * 10; + } + $("html, body").animate({ + scrollTop: iScroll + }, { + duration : iScrollInterval, + easing : "linear", + complete : function() { + setTimeout(function(){ + $(window).scrollTop(0); + window.location.reload(); + }, iInterval); + } + }); + }; + setTimeout(loop, iInterval); + {% endif %} {% if tournament.club.header %}