Skip to content

Instantly share code, notes, and snippets.

@Pyrolistical
Created July 21, 2025 05:37
Show Gist options
  • Save Pyrolistical/a1751f359fa1ffb43bc716659d4233e3 to your computer and use it in GitHub Desktop.
Save Pyrolistical/a1751f359fa1ffb43bc716659d4233e3 to your computer and use it in GitHub Desktop.
Static slideshow webpage
<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