Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mvsde/lightbox

Barebones lightbox library.
https://github.com/mvsde/lightbox

css html javascript lightbox

Last synced: 30 days ago
JSON representation

Barebones lightbox library.

Awesome Lists containing this project

README

        

# Lightbox

Mostly unstyled barebones lightbox library.

## Installation

```bash
npm install @mvsde/lightbox focus-trap
```

## JavaScript

```js
import { Lightbox, LightboxLink } from '@mvsde/lightbox'

const lightbox = new Lightbox({
element: document.querySelector('#lightbox')
})

lightbox.init()

const lightboxLinks = document.querySelectorAll('.js-lightbox-link')

for (const link of lightboxLinks) {
new LightboxLink({ element: link, target: lightbox }).init()
}
```

## CSS

```css
@import '@mvsde/lightbox';
```

## Trigger link HTML

```html

Yosemite valley at dawn

```

## Popup HTML

The `data-padding` attribute is optional and defaults to `32`.

```html


```