You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>spin3d</title>
<style>
html, body {
margin: 0;
}
.container {
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: dodgerblue;
}
h1 {
font-size: 4rem;
font-family: sans-serif;
position: relative;
z-index: 50;
color: white;
margin-bottom: 0;
}
.subtitle {
font-weight: bold;
font-family: sans-serif;
color: white;
z-index: 50;
font-size: 2rem;
}
img {
position: absolute;
top: 0;
left: 0;
width: 100%;
hegiht: 100%;
object-fit: contain;
}
#front {
z-index: 100;
}
</style>
</head>
<body>
<div class="container">
<img id="back" src="backp/0001.webp" alt="">
<h1>How to make your server run 4x faster</h1>
<div class="subtitle">And other <span id="first">situated</span> code documentation <span id="second">practices</span> </div>
<img id="front" src="frontp/0001.webp" alt="">
</div>
<script>
let terms;
const front = document.querySelector('#front')
const back = document.querySelector('#back')
const container = document.querySelector('.container')
const first = document.querySelector('#first')
const second = document.querySelector('#second')
const totalImages = 36
let index = 0;
const filename = (index) => index.toString().padStart(4, '0') + '.webp'
const change = (e) => {
let newIndex = Math.floor(e.clientX / container.clientWidth * totalImages)
if (newIndex != index) {
index = newIndex
let image = filename(index+1)
front.src = `frontp/${image}`
back.src = `backp/${image}`
first.innerText = terms[index][0]
second.innerText = terms[index][1]
}
}
window.addEventListener('load', async ()=> {
terms = await fetch('terms.json').then(res=>res.json()).then(res=>res.terms)
container.addEventListener('mousemove', (e)=> change(e))
})
</script>
</body>
</html>