After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 38 KiB |
@ -0,0 +1,97 @@ |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<title>Vesmír</title> |
|||
<style> |
|||
section{ |
|||
height: 100vh; |
|||
} |
|||
|
|||
#hvezdy{ |
|||
color: white; |
|||
} |
|||
|
|||
.earth-fixed{ |
|||
position: fixed; |
|||
width: 200px; |
|||
opacity: 0; |
|||
} |
|||
#zjeveni{ |
|||
color: white; |
|||
} |
|||
#rotace{ |
|||
color: white; |
|||
} |
|||
|
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id="earth"> |
|||
<img class="earth-fixed" src="img/e1.jpg" alt=""> |
|||
</div> |
|||
<section id="uvod"> |
|||
void |
|||
</section> |
|||
<section id="dark"> |
|||
dark |
|||
</section> |
|||
<section id="hvezdy"> |
|||
hvězdy |
|||
</section> |
|||
<section id="zjeveni"> |
|||
zjeveni |
|||
</section> |
|||
<section id="rotace"> |
|||
rotace |
|||
</section> |
|||
|
|||
<script> |
|||
function handler () { |
|||
let dark = document.querySelector('#dark'); |
|||
let dark_rect = dark.getBoundingClientRect(); |
|||
console.log("dark: " + dark_rect.top); |
|||
let value = Math.ceil(255 * (dark_rect.top / dark_rect.height)); |
|||
if (value >= 0 && value <= 255) { |
|||
document.body.style.backgroundColor = "rgb(" + value + "," + value + "," + value + ")"; |
|||
} |
|||
|
|||
let hvezdy = document.querySelector('#hvezdy'); |
|||
let hvezdy_rect = hvezdy.getBoundingClientRect(); |
|||
console.log("hvezdy: " + (hvezdy_rect.height - hvezdy_rect.top)); |
|||
if (hvezdy_rect.height - hvezdy_rect.top > 0) { |
|||
let opacity = (hvezdy_rect.top / hvezdy_rect.height); |
|||
console.log("Opacity: " + opacity); |
|||
} |
|||
|
|||
let zjeveni = document.querySelector('#zjeveni'); |
|||
let zjeveni_rect = zjeveni.getBoundingClientRect(); |
|||
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 = 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/e" + cislo + ".jpg"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
//cisla v konzoli |
|||
window.addEventListener('load', handler, false); |
|||
window.addEventListener('scroll', handler, false); |
|||
window.addEventListener('resize', handler, false); |
|||
</script> |
|||
</body> |
|||
</html> |