Zum Inhalt springen
Skillpedia
Websites & UI (Frontend)7.1k · #13596

lightgallery

Was er macht

Diese Fähigkeit leitet den Agenten beim Einbau des lightGallery-Viewers in eine Website, die mit reinem JavaScript, React, Vue oder Angular gebaut ist. Sie erklärt, welches Paket zu installieren ist, welche Plugins und Stile nötig sind und welche Einstellungen am häufigsten Probleme verursachen.

Wann du ihn nutzt

  • ✓Wenn du eine Fotogalerie willst, die Bilder in einem Vollbild-Viewer öffnet.
  • ✓Wenn du Zoom, Miniaturleisten oder YouTube- und Vimeo-Videos in einer Galerie brauchst.
  • ✓Wenn eine Galerie auf deiner Seite kaputt ist oder sich seltsam verhält und der Agent die Ursache finden soll.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/sachinchoolur/lightGallery/blob/main/skills/lightgallery/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Ich möchte auf meiner Produktseite eine Fotogalerie mit Miniaturen und Zoom.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent installiert das passende lightGallery-Paket für dein Projekt und ergänzt die Funktionen, die du wählst. Er folgt einem Standard-Einrichtungsrezept und setzt die Bildgrößen, damit die Öffnungsanimation stimmt.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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
Häufige Fragen

Welche Frameworks deckt die Galerie-Fähigkeit ab?

Reines JavaScript und TypeScript, React, Vue 3 und Angular. Der Agent nutzt das Paket, das zu deinem Projekt passt.

Warum öffnet sich meine Galerie ohne Zoomanimation?

Meist fehlen Breite und Höhe der Bilder. Die Fähigkeit liest die Größe aus jeder Bilddatei, damit die Animation von der Miniatur aus startet.

Muss ich die Galerie-Stile selbst einbinden?

Ja. Die Framework-Pakete enthalten keine Stile, daher importiert der Agent die CSS-Dateien in dein Projekt.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
7.1k
Platz im Ranking
#13596
Lizenz
GPL-3.0
Aktualisiert
14.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Ähnliche Skills