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