Zum Hauptinhalt springen
VelinStyle v1.2.0
⌂ Home
  1. Docs
  2. Erste Schritte
  3. Lightbox

Lightbox 1.2.0

<velin-lightbox> is a fullscreen media overlay for slotted images and videos. In 1.2.0, open/close uses Fokus-manager for background inert and scroll lock; close fires velin-close. English: Lightbox

Reifegrad: Dokumentiert als stabil in VelinStyle 1.2.0. Design Intelligence (Plan / Review / Agent-Meta) ist separat und Beta / Grundlage wo entsprechend angegeben.

Wann verwenden

Wann nicht verwenden

Slot <img> (or <video>) children. Clicks call open(index). Optional data-velin-lightbox overrides the full-size URL (sanitized).

Mountain lake Dog portrait Misty forest
<velin-lightbox>
  <img src="photo-thumb-1.jpg"
       data-velin-lightbox="photo-full-1.jpg"
       alt="Mountain lake">
  <img src="photo-thumb-2.jpg"
       data-velin-lightbox="photo-full-2.jpg"
       alt="Dog portrait">
</velin-lightbox>

Tastaturnavigation

While open, Fokus starts on the close Button. / change slides, Escape closes, and Tab is trapped in the overlay. A polite live region and announce() report the slide counter.

<!-- Built-in keys: ArrowLeft / ArrowRight / Escape / Tab trap -->
<velin-lightbox>
  <img src="thumb1.jpg" alt="Slide 1">
  <img src="thumb2.jpg" alt="Slide 2">
</velin-lightbox>

Video-Unterstützung

Slot a <video> (or point data-velin-lightbox at a media URL). Video items render with controls and autoplay inside the overlay.

<velin-lightbox>
  <img src="photo-thumb.jpg" alt="Photo">
  <video src="clip.mp4" poster="video-poster.jpg"
         aria-label="Short clip"></video>
</velin-lightbox>

Barrierefreiheit

Dark Mode, Responsivität, Bewegung, RTL

API

Methoden & events

APIBeschreibung
open(index = 0)Opens at slide index; sets open; applies inert
close()Closes, clears inert, restores Fokus, fires velin-close
velin-closeBubbling-Close-Event

Slots & parts

NameBeschreibung
Standard slotIMG, VIDEO, or elements with data-velin-lightbox
Partsoverlay, content, counter

CSS-Variablen

VariableBeschreibung
--velin-z-modalOverlay-Z-Index (Standard 500)
--velin-radius-mdEckenradius der Medien
--velin-color-FokusFokus-Outline an Bedienelementen

Best practices & pitfalls