मुख्य सामग्री पर जाएँ
Skillpedia
वेबसाइट और UI (frontend)7.1k · #13596

lightgallery

यह क्या करती है

यह स्किल एजेंट को lightGallery व्यूअर को उन वेबसाइटों में जोड़ने का मार्गदर्शन करती है जो सादे JavaScript, React, Vue या Angular से बनी हों। यह बताती है कि कौन-सा पैकेज इंस्टॉल करना है, कौन-से प्लगइन और स्टाइल शामिल करने हैं, और कौन-सी सेटिंग्स सबसे ज़्यादा समस्या देती हैं।

कब इस्तेमाल करें

  • ✓जब आप चाहते हों कि आपकी साइट पर फ़ोटो फ़ुल-स्क्रीन व्यूअर में खुलें।
  • ✓जब आपको गैलरी में ज़ूम, थंबनेल स्ट्रिप या YouTube और Vimeo वीडियो चाहिए।
  • ✓जब आपकी साइट की कोई गैलरी टूटी हो या अजीब व्यवहार करे और आप एजेंट से कारण ढूंढवाना चाहते हों।

Skill का लिंक

https://github.com/sachinchoolur/lightGallery/blob/main/skills/lightgallery/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/sachinchoolur/lightGallery/blob/main/skills/lightgallery/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मुझे अपने प्रोडक्ट पेज पर थंबनेल और ज़ूम वाली फ़ोटो गैलरी चाहिए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट आपके प्रोजेक्ट के लिए सही lightGallery पैकेज इंस्टॉल करता है और आपकी चुनी सुविधाएँ जोड़ता है। वह एक मानक सेटअप विधि का पालन करता है और इमेज का आकार ऐसे सेट करता है कि खुलने का एनिमेशन सही दिखे।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

lightGallery

One gallery, four packages with the same features and settings:

Stack Package Plugins import path
Vanilla JS / TypeScript lightgallery lightgallery/plugins/<name>
React @lightgallery/react @lightgallery/react/plugins/<name>
Vue 3 @lightgallery/vue @lightgallery/vue/plugins/<name>
Angular @lightgallery/angular @lightgallery/angular/plugins/<name>

Plugin names: thumbnail, zoom, video, autoplay, fullscreen, share, hash, rotate, pager, comment, mediumZoom, relativeCaption, vimeoThumbnail, originCrop, justified. Each is a separate entry — import only what the project uses.

Default recipe. Unless the user asks for something else, every image gallery gets the zoom and thumbnail plugins, their two CSS files, and lgSize: 'WIDTH-HEIGHT' (data-lg-size in markup) on every image item. lgSize is the natural size of the full image; it drives the zoom-from-origin animation, where the slide opens from the clicked thumbnail and closes back to it. Without it the slide fades in. Read the dimensions from the image files, the image optimizer or the CMS rather than dropping the field. Leave a plugin out only when told to.

Two rules that prevent most problems

  1. CSS is a consumer import in every stack. The framework packages ship no CSS. Import lightgallery/css/lightgallery.css plus one file per plugin (lightgallery/css/lg-thumbnail.css, lg-zoom.css, …), or lightgallery/css/lightgallery-bundle.css for everything.
  2. Plugins are opt-in. A feature only exists when its plugin is passed (plugins: [...], plugins={[...]}, :plugins="[...]", [features]="[withX()]"). Its settings are ignored otherwise.

Vanilla JavaScript

import lightGallery from 'lightgallery';
import lgThumbnail from 'lightgallery/plugins/thumbnail';
import lgZoom from 'lightgallery/plugins/zoom';
import 'lightgallery/css/lightgallery.css';
import 'lightgallery/css/lg-thumbnail.css';
import 'lightgallery/css/lg-zoom.css';

const gallery = lightGallery(document.getElementById('gallery'), {
    plugins: [lgZoom, lgThumbnail],
    speed: 400,
});

Markup mode: the container holds anchors; each anchor's href (or data-src) is the full image, the inner <img> is the thumbnail, and data-lg-size="WIDTH-HEIGHT" is the full image's natural size for the zoom-from-origin animation. Captions come from data-sub-html. If items are not direct children, set selector. Dynamic mode: dynamic: true, dynamicEl: [{ src, thumb, lgSize, subHtml }] and call gallery.openGallery(index).

Methods: openGallery(index), closeGallery(), refresh() after the markup changed, destroy(). Events fire on the container element (lgBeforeOpen, lgAfterSlide, …) with data in event.detail; attach listeners before initializing.

React

'use client'; // Next.js App Router: the gallery is a client component
import { LightGallery, LightGalleryItem } from '@lightgallery/react';
import Thumbnail from '@lightgallery/react/plugins/thumbnail';
import Zoom from '@lightgallery/react/plugins/zoom';

// items: [{ src, thumb, alt, lgSize: '1600-1067' }, …]
export function Gallery({ items }) {
    return (
        <LightGallery plugins={[Zoom, Thumbnail]} thumbnail={{ animateThumb: true }}>
            {items.map((item) => (
                <LightGalleryItem key={item.src} item={item}>
                    <img src={item.thumb} alt={item.alt} />
                </LightGalleryItem>
            ))}
        </LightGallery>
    );
}

Import the CSS in the root layout. Plugin settings are objects on props named after the plugin (zoom={{ … }}, thumbnail={{ … }}); bare boolean props are not valid. Callbacks are onAfterSlide, onBeforeOpen, …; the imperative handle (ref) exposes openGallery, closeGallery, goToSlide, nextSlide, prevSlide. Use either the controlled open prop or the uncontrolled default for the component's whole lifetime, not both. The package is SSR-safe; no dynamic(..., { ssr: false }) needed.

Vue 3

<script setup>
import { LightGallery, LgItem } from '@lightgallery/vue';
import Thumbnail from '@lightgallery/vue/plugins/thumbnail';
import Zoom from '@lightgallery/vue/plugins/zoom';

const items = [{ src: '/photos/1.jpg', thumb: '/photos/1-thumb.jpg', alt: 'One', lgSize: '1600-1067' }];
</script>

<template>
    <LightGallery :plugins="[Zoom, Thumbnail]" :thumbnail
अक्सर पूछे जाने वाले सवाल

यह गैलरी स्किल किन फ़्रेमवर्क को कवर करती है?

यह सादे JavaScript और TypeScript, React, Vue 3 और Angular को कवर करती है। एजेंट वही पैकेज इस्तेमाल करता है जो आपके प्रोजेक्ट से मेल खाए।

मेरी गैलरी ज़ूम एनिमेशन के बिना क्यों खुलती है?

आमतौर पर इमेज की चौड़ाई और ऊँचाई नहीं होती। स्किल कहती है कि हर इमेज फ़ाइल से आकार पढ़ें, ताकि एनिमेशन थंबनेल से शुरू हो सके।

क्या मुझे गैलरी की स्टाइल खुद जोड़नी होगी?

हाँ। फ़्रेमवर्क पैकेज में स्टाइल शामिल नहीं होती, इसलिए एजेंट CSS फ़ाइलें आपके प्रोजेक्ट में इम्पोर्ट करता है।

जानकारी

लेखक का मूल विवरण

Add or configure a lightGallery image/video lightbox or gallery in vanilla JavaScript, React, Vue or Angular — install, imports, plugins, CSS, settings, and the pitfalls that produce most bug reports. Use when a project needs a lightbox, photo gallery, thumbnail strip, zoomable images or a YouTube/Vimeo gallery, or when editing code that imports lightgallery or @lightgallery/*.

repo: sachinchoolur/lightGallery

लोकप्रियता

GitHub स्टार
7.1k
रैंकिंग में स्थान
#13596
लाइसेंस
GPL-3.0
अपडेट की गई
14/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

मिलती-जुलती skills