From 66f10cdf7221cfb1f8da0b8b0927e79ad9228299 Mon Sep 17 00:00:00 2001 From: david subr Date: Wed, 2 Jun 2021 21:33:36 +0200 Subject: [PATCH] mm --- index.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index df8964a..4319375 100644 --- a/index.html +++ b/index.html @@ -70,10 +70,20 @@ let zeme_img = document.querySelector(".earth-fixed"); console.log("zjeveni: " + (zjeveni_rect.height - zjeveni_rect.top)); if (zjeveni_rect.height - zjeveni_rect.top > 0) { - let opacity = (zjeveni_rect.top / zjeveni_rect.height); + let opacity = 1 - (zjeveni_rect.top / zjeveni_rect.height); console.log("zjeveni opacity: " + opacity) zeme_img.style.opacity = opacity; } + let rotace = document.querySelector('#rotace'); + let rotace_rect = rotace.getBoundingClientRect(); + console.log("rotace: " + (rotace_rect.height - rotace_rect.top)); + if (rotace_rect.height - rotace_rect.top > 0) { + let cislo = Math.ceil(13 * (1 - (rotace_rect.top / rotace_rect.height))); + console.log("cislo: " + cislo); + if (cislo >= 1 && cislo <= 13) { + zeme_img.setAttribute("src", "img/img/e" + cislo + ".jpg"); + } + } } //cisla v konzoli