Responsive, zero-dependency image gallery with lightbox.
index.html: Main page with Gallery, About, Contact, and lightbox markupassets/css/styles.css: Styles for layout, grid, and lightboxassets/js/main.js: Renders images and handles lightbox interactionsassets/img/: Place your image files here
- Add images to
assets/img/. - Open
assets/js/main.jsand add entries to theimagesarray, e.g.:
var images = [
{ src: "assets/img/photo1.jpg", alt: "Sunset at lake", caption: "Lakeview, 2024" },
{ src: "assets/img/photo2.jpg", alt: "Forest trail", caption: "Morning hike" }
];- Open
index.htmlin a browser.
Keyboard shortcuts inside the lightbox:
- Left/Right arrow: previous/next
- Escape: close
- Images are not auto-discovered for portability. Explicitly list them in
main.js. - Thumbnails use object-fit cover; original images show in the lightbox.