Skip to content
This repository

A simple lightbox plugin based on the bootstrap modal plugin.

branch: master

Update docs, move to v0.7.0

Thank you to @jamespegg for adding the gallery/next-previous feature. With that we will move to v0.7.0.
latest commit 8660943c06
Jason Butz authored
Octocat-spinner-32 docs Update docs, move to v0.7.0 January 17, 2014
Octocat-spinner-32 js Update docs, move to v0.7.0 January 17, 2014
Octocat-spinner-32 less Added captions September 24, 2013
Octocat-spinner-32 .gitignore Fixed tests April 25, 2013
Octocat-spinner-32 .npmignore Integrated Travis-CI, Fixed CSS version number, updated js formatting October 17, 2012
Octocat-spinner-32 .travis.yml Fixed tests April 25, 2013
Octocat-spinner-32 LICENSE.md Adding LICENSE.md file November 29, 2012
Octocat-spinner-32 Makefile Update docs, move to v0.7.0 January 17, 2014
Octocat-spinner-32 README.md Added captions September 24, 2013
Octocat-spinner-32 component.json Update docs, move to v0.7.0 January 17, 2014
Octocat-spinner-32 package.json Update docs, move to v0.7.0 January 17, 2014
README.md

Bootstrap - Lightbox Build Status

This is a plugin for Twitter Bootstrap that adds a lightbox that is based off the modal dialog

Quick start

You have several options. You can clone the repository git clone git://github.com/jbutz/bootstrap-lightbox.git, grab an archive, or use cdnjs.

Once you have the files include the CSS and JavaScript files in your page and then give the example code below a shot.

Example

<a data-toggle="lightbox" href="#demoLightbox">Open Lightbox</a>
<div id="demoLightbox" class="lightbox fade"  tabindex="-1" role="dialog" aria-hidden="true">
    <div class='lightbox-dialog'>
        <div class='lightbox-content'>
            <img src="image.png">
            <div class='lightbox-caption'>
                Your caption here
            </div>
        </div>
    </div>
</div>

Usage

Via data attributes

All you need to do is add data-toggle="lightbox" and href="#lightbox" or data-target="#lightbox" to a link, and set the href so it references the lightbox you want to display.

<a data-toggle="lightbox" href="#demoLightbox">Open Lightbox</a>

Via JavaScript

Open the lightbox with the id myLightbox.

$('#myLightbox').lightbox(options)

Options

Name Type Default Description
backdrop boolean true This adds a modal-backdrop element.
keyboard boolean true Pressing escape closes the lightbox.
show boolean true Shows the lightbox when initialized.
Note: This only applies when using JavaScript to setup the lightbox.
resizeToFit boolean true This resizes the image to fit the window if the image is too large.
Something went wrong with that request. Please try again.