组件 图像灯箱 Image Lightbox 组件

Image Lightbox 组件

一个简单、响应迅速、玻璃形态风格的图像灯箱组件,具有海洋/蓝色调,适用于社交媒体,支持深色模式。

预览

HTML 代码

<div class="flex items-center justify-center min-h-screen bg-gradient-to-br from-blue-100 via-blue-200 to-blue-300 dark:from-gray-900 dark:via-gray-800 dark:to-gray-700 p-4 font-sans">

  <!-- Lightbox Container (visible only when 'open', hidden by default using styling concepts, not direct JS) -->
  <!-- In a real scenario, this would be toggled by JS. For pure HTML/CSS, it's assumed to be 'open' for demonstration. -->
  <!-- To simulate true hidden/shown: display: none initially, display: flex on active class. -->
  <div class="fixed inset-0 z-50 flex items-center justify-center bg-blue-900 bg-opacity-30 dark:bg-black dark:bg-opacity-70 backdrop-blur-sm">
    
    <div class="relative w-full max-w-3xl mx-auto p-4 bg-white bg-opacity-20 dark:bg-gray-800 dark:bg-opacity-30 rounded-2xl shadow-xl border border-blue-500 border-opacity-30 dark:border-gray-600 dark:border-opacity-30 backdrop-filter backdrop-blur-lg">
      
      <!-- Close Button -->
      <button class="absolute top-3 right-3 text-white hover:text-blue-200 dark:text-gray-300 dark:hover:text-gray-100 text-3xl font-bold transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 rounded-full w-10 h-10 flex items-center justify-center">
        &times;
      </button>

      <!-- Lightbox Content -->
      <div class="flex flex-col md:flex-row gap-4 items-center">
        
        <!-- Image Area -->
        <div class="w-full md:w-3/5 rounded-lg overflow-hidden border border-blue-400 dark:border-gray-500 shadow-md">
          <img src="https://picsum.photos/800/600?random=1" alt="Full size image" class="w-full h-auto object-cover">
        </div>

        <!-- Details Area -->
        <div class="w-full md:w-2/5 text-white dark:text-gray-200 p-2 md:p-0">
          <h3 class="text-2xl font-semibold mb-2 text-white dark:text-white">Ocean Sunset</h3>
          <p class="text-sm mb-4 text-blue-100 dark:text-gray-300">A breathtaking view of the sunset over the serene ocean. Captured during my recent trip, truly mesmerizing.</p>

          <!-- User Info -->
          <div class="flex items-center mb-4">
            <img src="https://randomuser.me/api/portraits/women/44.jpg" alt="User Avatar" class="w-10 h-10 rounded-full mr-3 border-2 border-blue-300 dark:border-gray-400">
            <div>
              <p class="font-medium text-blue-50 dark:text-gray-100">Jane Doe</p>
              <p class="text-xs text-blue-100 dark:text-gray-300">@janedoe | 2 hours ago</p>
            </div>
          </div>

          <!-- Action Buttons -->
          <div class="flex gap-3 mt-4">
            <button class="flex-1 py-2 px-4 bg-blue-600 bg-opacity-70 dark:bg-blue-700 dark:bg-opacity-60 text-white rounded-lg hover:bg-blue-700 hover:bg-opacity-80 dark:hover:bg-blue-800 dark:hover:bg-opacity-70 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-70">
              <span class="mr-2 text-lg">&hearts;</span> Like
            </button>
            <button class="flex-1 py-2 px-4 bg-blue-600 bg-opacity-70 dark:bg-blue-700 dark:bg-opacity-60 text-white rounded-lg hover:bg-blue-700 hover:bg-opacity-80 dark:hover:bg-blue-800 dark:hover:bg-opacity-70 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-70">
              <span class="mr-2 text-lg">&#x1F4AD;</span> Comment
            </button>
          </div>
        </div>
      </div>
    </div>

  </div>
</div>

相关组件

游戏 3D 紫色灯箱

一个简单的响应式图像灯箱组件,具有 3D 设计元素和紫色/紫色配色方案,适用于游戏网站。

打开

图片灯箱组件

适用于博客或内容平台的粗野派风格图像灯箱组件,采用大地色调和复杂的交互式元素设计。

打开

用于房地产的 Glassmorphism Lightbox,带有棕褐色调

具有玻璃形态设计的响应式图像灯箱组件,具有磨砂玻璃般的半透明元素和棕褐色/棕色色调,适用于房地产图片库。包括深色模式支持。

打开