组件 图像灯箱 图像灯箱组件

图像灯箱组件

一个响应式图像灯箱组件,专为电子商务设计,具有极简的扁平化设计风格,使用 Tailwind CSS 支持浅色和深色主题。

预览

HTML 代码

<div class="relative inline-block cursor-pointer group">
    <img src="https://picsum.photos/600/400" alt="Lightbox" class="w-full h-auto rounded-lg shadow-sm transition duration-300 ease-in-out transform group-hover:scale-105">
    <div class="absolute inset-0 bg-black bg-opacity-50 opacity-0 transition-opacity duration-300 ease-in-out group-hover:opacity-100 rounded-lg"></div>
    <div class="absolute inset-0 flex items-center justify-center opacity-0 transition-opacity duration-300 ease-in-out group-hover:opacity-100">
        <span class="text-white text-2xl font-semibold">View Image</span>
    </div>
</div>

<!-- Lightbox Modal -->
<div id="lightbox-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-gray-900 bg-opacity-80 hidden">
    <div class="relative w-full max-w-3xl">
        <img src="https://picsum.photos/1200/800" alt="Lightbox Image" class="w-full h-auto rounded-lg shadow-lg">
        <button class="absolute top-4 right-4 text-white bg-red-500 hover:bg-red-600 rounded-full p-2 transition duration-300 ease-in-out">✖</button>
    </div>
</div>

<style>
    /* Dark Mode Support */
    .dark .bg-gray-900 { background-color: #1b1b1b; }
    .dark .bg-black { background-color: #000; }
</style>

相关组件

图片灯箱组件

专为电子商务网站设计的简单响应式图像灯箱组件,具有深色模式样式和类似的配色方案。

打开

Image Lightbox 组件

响应式图像灯箱组件,具有水彩/艺术设计、柔和的颜色和深色模式支持,适用于教育平台。

打开

Cyberpunk_Real_Estate_Lightbox

一个简单的响应式图像灯箱组件,具有赛博朋克风格的柔和配色方案,适用于房地产列表。具有深色模式支持并使用语义 HTML。

打开