Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
Sowas in der Art? https://leandrovieira.com/projects/jquery/lightbox/
musst du nach lightbox suchen... denke das trifft ziemlich genau das was du suchst.
<?php
$files = glob('*.{bmp,gif,jpg,png}', GLOB_BRACE);
/* Oder wenn das Ganze weniger dynamisch sein soll:
$files = array(
'bild1.jpg',
'bild2.jpg',
'bild3.jpg',
);
*/
$file = isset($_GET['view']) ? $_GET['view'] : reset($files);
?>
<style>
#gallery {
background: #888;
text-align: center;
}
#gallery a {
text-decoration: none;
}
#gallery > img {
height: 400px;
}
#gallery ul {
list-style: none;
}
#gallery li {
display: inline-block;
margin: 0 0.5em;
}
#gallery li img {
height: 64px;
}
</style>
<div id="gallery">
<img src="<?= $file ?>">
<ul>
<?php foreach ($files as $file): ?>
<li><a href="<?= $_SERVER['PHP_SELF'] ?>?view=<?= urlencode($file) ?>">
<img src="<?= $file ?>">
</li>
<?php endforeach; ?>
</ul>
</div>
<script>
(function () {
var image = document.querySelector('#gallery > img');
document.querySelector('#gallery')
.addEventListener('click', function (event) {
var element = event.target;
if (element.parentNode.nodeName === 'A') {
image.src = event.target.src;
event.preventDefault();
}
});
}());
</script>