본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)7.1k · #13596

lightgallery

하는 일

이 스킬은 순수 JavaScript, React, Vue, Angular로 만든 웹사이트에 lightGallery 뷰어를 추가하는 과정을 에이전트에게 안내합니다. 설치할 패키지, 포함할 플러그인과 스타일, 가장 자주 문제를 일으키는 설정을 설명합니다.

사용하는 경우

  • ✓사진을 누르면 전체 화면 뷰어로 열리는 갤러리를 사이트에 넣고 싶을 때.
  • ✓갤러리에 확대, 썸네일 목록, 또는 YouTube와 Vimeo 동영상을 넣어야 할 때.
  • ✓사이트의 갤러리가 고장 나거나 이상하게 동작해서 원인을 찾고 싶을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sachinchoolur/lightGallery/blob/main/skills/lightgallery/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제품 페이지에 썸네일과 확대 기능이 있는 사진 갤러리를 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 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
업데이트
2026. 10. 14.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

비슷한 스킬