Category · Photo Galleries Difficulty Level · Intermediate Published on · January 15, 2024

Interactive Image Gallery

A responsive image gallery with lightbox functionality, filtering, and smooth animations

#gallery #lightbox #responsive #interactive

Responsive Design

Yes

Dark Mode Support

No

lines

498

Browser Compatibility

No

Live Preview

Interact with the component without leaving the page.

600px

Interactive Image Gallery

A responsive image gallery with lightbox functionality, filtering options, and smooth animations. Features include category filtering, lazy loading, keyboard navigation, and a beautiful lightbox modal for viewing images in detail.

HTML

31

lines

CSS

249

lines

JavaScript

218

lines


                <div class="gallery-container">
  <div class="gallery-header">
    <h2>Interactive Image Gallery</h2>
    <div class="filter-buttons">
      <button class="filter-btn active" data-filter="all">All</button>
      <button class="filter-btn" data-filter="nature">Nature</button>
      <button class="filter-btn" data-filter="city">City</button>
      <button class="filter-btn" data-filter="portrait">Portrait</button>
    </div>
  </div>
  
  <div class="gallery-grid" id="galleryGrid">
    <!-- Images will be dynamically loaded here -->
  </div>
  
  <button class="load-more-btn" id="loadMoreBtn">Load More</button>
</div>

<!-- Lightbox Modal -->
<div class="lightbox" id="lightbox">
  <div class="lightbox-content">
    <span class="close-btn" id="closeBtn">&times;</span>
    <img class="lightbox-image" id="lightboxImage" src="" alt="">
    <div class="lightbox-info">
      <h3 id="lightboxTitle"></h3>
      <p id="lightboxDescription"></p>
    </div>
    <button class="nav-btn prev-btn" id="prevBtn">&#10094;</button>
    <button class="nav-btn next-btn" id="nextBtn">&#10095;</button>
  </div>
</div>

              
31lines
1111characters
HTMLLanguage

Related Code Snippets

Explore template packs

Need larger building blocks? Browse responsive landing pages and component bundles.

Open HTML Template Library →