formstone
Version:
Library of modular front end components.
41 lines (32 loc) • 916 B
Markdown
### Basic
Display images and videos in an overlay:
```javascript
$("a").lightbox();
```
```markup
<a href="one.jpg" title="Image Caption">
<img src="one_thumb.jpg" alt="">
</a>
```
### Gallery
Link multiple images or videos together with the `data-lightbox-gallery` attribute:
```markup
<a href="one.jpg" title="Image Caption One" data-lightbox-gallery="photo_gallery">
<img src="one_thumb.jpg" alt="">
</a>
<a href="two.jpg" title="Image Caption Two" data-lightbox-gallery="photo_gallery">
<img src="two_thumb.jpg" alt="">
</a>
<a href="three.jpg" title="Image Caption Three" data-lightbox-gallery="photo_gallery">
<img src="three_thumb.jpg" alt="">
</a>
```
<h3>Events</h3>
React to the lightbox by listening for the `open.lightbox` and `close.lightbox` events on the `window`:
```javascript
$(window).on("open.lightbox", function() {
// ...
}).on("close.lightbox", function() {
// ...
});
```