lightgallery
Qué hace
Esta skill guía al agente para añadir el visor lightGallery a un sitio web construido con JavaScript puro, React, Vue o Angular. Explica qué paquete instalar, qué plugins y estilos incluir y los ajustes que más problemas suelen causar.
Cuándo usarla
- ✓Cuando quieres una galería de fotos que abra las imágenes en un visor a pantalla completa en tu sitio.
- ✓Cuando necesitas zoom, tiras de miniaturas o videos de YouTube y Vimeo en una galería.
- ✓Cuando una galería de tu sitio está rota o se comporta de forma extraña y quieres que el agente encuentre la causa.
Link de la skill
https://github.com/sachinchoolur/lightGallery/blob/main/skills/lightgallery/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Quiero una galería de fotos con miniaturas y zoom en mi página de producto.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente instala el paquete de lightGallery adecuado para tu proyecto y añade las funciones que elijas. Sigue una receta de configuración estándar y define los tamaños de imagen para que la animación de apertura se vea bien.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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
- CSS is a consumer import in every stack. The framework packages ship
no CSS. Import
lightgallery/css/lightgallery.cssplus one file per plugin (lightgallery/css/lg-thumbnail.css,lg-zoom.css, …), orlightgallery/css/lightgallery-bundle.cssfor everything. - 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
Preguntas frecuentes
¿Qué frameworks cubre?
Cubre JavaScript y TypeScript puros, React, Vue 3 y Angular. El agente usa el paquete que corresponde a tu proyecto.
¿Por qué mi galería se abre sin la animación de zoom?
Normalmente faltan el ancho y el alto de la imagen. La skill indica que hay que leer el tamaño de cada archivo para que la animación parta de la miniatura.
¿Tengo que añadir los estilos de la galería yo mismo?
Sí. Los paquetes de cada framework no incluyen estilos, así que el agente importa los archivos CSS en tu proyecto.
Detalles
Descripción original del autor
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/*.
Popularidad
- Estrellas en GitHub
- 7,1 mil
- Posición en el ranking
- #13596
- Licencia
- GPL-3.0
- Actualizada
- 14/10/2026
Comentarios
- …
Skills parecidas
angular-developer
280 milAyuda a tu agente con código de Angular y la estructura del proyecto. Útil para empezar proyectos, crear partes de código o mejorar el rendimiento y la accesibilidad.
frontend-a11y
280 milAyuda a tu agente a hacer que las interfaces web sean accesibles para todos. Asegura que sitios y apps funcionen bien con lectores de pantalla y navegación por teclado.
frontend-patterns
280 milHace que tu agente aplique patrones modernos en desarrollo frontend. Optimiza el rendimiento, gestiona el estado y sigue buenas prácticas en React y Next.js.