Created
July 21, 2025 05:37
-
-
Save Pyrolistical/a1751f359fa1ffb43bc716659d4233e3 to your computer and use it in GitHub Desktop.
Static slideshow webpage
This file contains hidden or 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
<html> | |
<head> | |
<style> | |
body { | |
background-color: black; | |
background-position: center; | |
background-size: contain; | |
background-repeat: no-repeat; | |
transition: background 0.2s ease-in-out; | |
} | |
</style> | |
<script> | |
async function showNextSlide(dirHandle) { | |
for await (const handle of dirHandle.values()) { | |
try { | |
const file = await handle.getFile() | |
document.body.style.backgroundImage = `url('${URL.createObjectURL(file)}')` | |
await new Promise((resolve) => { | |
setTimeout(resolve, 5000) | |
}) | |
} catch { | |
continue | |
} | |
} | |
setTimeout(showNextSlide, 0, dirHandle) | |
} | |
async function pickDir() { | |
const dirHandle = await window.showDirectoryPicker({ | |
startIn: 'pictures' | |
}) | |
document.body.innerHTML = '' | |
showNextSlide(dirHandle) | |
} | |
</script> | |
</head> | |
<body><button id="picker">pick image folder</button> | |
<script> | |
document.getElementById('picker').addEventListener('click', pickDir) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment