Created
December 6, 2024 09:41
-
-
Save senko/452332c430a8975089dba7b424afb83e to your computer and use it in GitHub Desktop.
lo-fi slides proof of concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="hr"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<style> | |
html,body { | |
margin: 0; padding: 0; height: 100%; width: 100%; | |
font-family: sans-serif; background: #fff; | |
display: flex; align-items: center; justify-content: center; | |
} | |
.slide { | |
position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); | |
font-size: 6vw; font-weight: bold; text-transform: uppercase; | |
text-align: center; opacity: 0; transition: opacity 0.3s ease; | |
} | |
.active { opacity: 1; } | |
</style> | |
</head> | |
<body> | |
<div class="slide active">REZULTAT</div> | |
<div class="slide">RJEŠENJE</div> | |
<div class="slide">IZAZOV</div> | |
<script> | |
const slides = document.querySelectorAll('.slide'); | |
let current = 0; | |
function showSlide(index) { | |
slides[current].classList.remove('active'); | |
current = (index + slides.length) % slides.length; | |
slides[current].classList.add('active'); | |
} | |
document.addEventListener('keydown', e => { | |
if(e.key === 'ArrowRight') showSlide(current+1); | |
if(e.key === 'ArrowLeft') showSlide(current-1); | |
}); | |
document.addEventListener('click', () => showSlide(current+1)); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment