├── .gitignore ├── .npmignore ├── .travis.yml ├── LICENSE.md ├── Makefile ├── README.md ├── component.json ├── docs ├── assets │ ├── bootstrap-lightbox.zip │ ├── css │ │ ├── bootstrap-lightbox.css │ │ ├── bootstrap-lightbox.min.css │ │ ├── bootstrap.min.css │ │ ├── pygment_trac.css │ │ ├── qunit.css │ │ └── styles.css │ ├── img │ │ ├── Thumbs.db │ │ ├── glyphicons-halflings-white.png │ │ ├── glyphicons-halflings.png │ │ ├── large.png │ │ └── small.png │ ├── js │ │ ├── bootstrap-lightbox.js │ │ ├── bootstrap-lightbox.min.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ ├── less.min.js │ │ ├── qunit.js │ │ └── scale.fix.js │ └── prettify │ │ ├── lang-apollo.js │ │ ├── lang-clj.js │ │ ├── lang-css.js │ │ ├── lang-go.js │ │ ├── lang-hs.js │ │ ├── lang-lisp.js │ │ ├── lang-lua.js │ │ ├── lang-ml.js │ │ ├── lang-n.js │ │ ├── lang-proto.js │ │ ├── lang-scala.js │ │ ├── lang-sql.js │ │ ├── lang-tex.js │ │ ├── lang-vb.js │ │ ├── lang-vhdl.js │ │ ├── lang-wiki.js │ │ ├── lang-xq.js │ │ ├── lang-yaml.js │ │ ├── prettify.css │ │ └── prettify.js ├── build │ ├── .gitignore │ ├── README.md │ ├── index.js │ └── package.json ├── index.html └── templates │ ├── bonus.mustache │ ├── demo.mustache │ ├── home.mustache │ ├── layout.mustache │ └── usage.mustache ├── js ├── .jshintrc ├── bootstrap-lightbox.js └── tests │ ├── .jshintrc │ ├── index.html │ ├── pixel.png │ ├── run-qunit.js │ ├── test-manual.html │ ├── unit │ ├── bootstrap-lightbox.js │ └── qunit-setup.js │ └── vendor │ ├── bootstrap.js │ ├── bootstrap.min.css │ ├── jquery.js │ ├── less.min.js │ ├── qunit.css │ └── qunit.js ├── less └── bootstrap-lightbox.less └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | node_modules 3 | *~ 4 | .DS_STORE 5 | .htaccess 6 | npm-debug.log -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | before_script: 2 | - cd ./js/tests 3 | - echo "new Date().toString();" | phantomjs 4 | script: phantomjs run-qunit.js index.html -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Jason Butz (http://jasonbutz.info) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DATE=$(shell date +%I:%M%p) 2 | CHECK=\033[32m✔\033[39m 3 | HR=\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\# 4 | 5 | 6 | # 7 | # BUILD DOCS 8 | # 9 | 10 | build: 11 | @echo "\n${HR}" 12 | @echo "Building Bootstrap Lightbox..." 13 | @echo "${HR}\n" 14 | @./node_modules/.bin/jshint js/*.js --config js/.jshintrc 15 | @./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc 16 | @echo "Running JSHint on javascript... ${CHECK} Done" 17 | @./node_modules/.bin/recess --compile less/bootstrap-lightbox.less > docs/assets/css/bootstrap-lightbox.css.tmp 18 | @./node_modules/.bin/recess --compress less/bootstrap-lightbox.less > docs/assets/css/bootstrap-lightbox.min.css.tmp 19 | @echo "Compiling LESS with Recess... ${CHECK} Done" 20 | @node docs/build 21 | @cp js/*.js docs/assets/js/ 22 | @cp js/tests/vendor/jquery.js docs/assets/js/ 23 | @cp js/tests/vendor/bootstrap.js docs/assets/js/ 24 | @cp js/tests/vendor/*.css docs/assets/css/ 25 | 26 | @./node_modules/.bin/uglifyjs -nc docs/assets/js/jquery.js > docs/assets/js/jquery.min.js 27 | @./node_modules/.bin/uglifyjs -nc docs/assets/js/bootstrap.js > docs/assets/js/bootstrap.min.js 28 | 29 | @echo "Compiling documentation... ${CHECK} Done" 30 | @./node_modules/.bin/uglifyjs -nc docs/assets/js/bootstrap-lightbox.js > docs/assets/js/bootstrap-lightbox.min.tmp.js 31 | 32 | @echo "/*!\n* bootstrap-lightbox.js v0.7.0 \n* Copyright 2014 Jason Butz\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > docs/assets/js/copyright.js 33 | @cat docs/assets/js/copyright.js js/bootstrap-lightbox.js > docs/assets/js/bootstrap-lightbox.js 34 | @cat docs/assets/js/copyright.js docs/assets/js/bootstrap-lightbox.min.tmp.js > docs/assets/js/bootstrap-lightbox.min.js 35 | @rm docs/assets/js/copyright.js docs/assets/js/bootstrap-lightbox.min.tmp.js 36 | 37 | @echo "/*!\n* bootstrap-lightbox.css v0.7.0 \n* Copyright 2014 Jason Butz\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > docs/assets/css/copyright.css 38 | @cat docs/assets/css/copyright.css docs/assets/css/bootstrap-lightbox.css.tmp > docs/assets/css/bootstrap-lightbox.css 39 | @cat docs/assets/css/copyright.css docs/assets/css/bootstrap-lightbox.min.css.tmp > docs/assets/css/bootstrap-lightbox.min.css 40 | @rm docs/assets/css/copyright.css docs/assets/css/bootstrap-lightbox.css.tmp docs/assets/css/bootstrap-lightbox.min.css.tmp 41 | 42 | @echo "Compiling and minifying javascript... ${CHECK} Done" 43 | @echo "\n${HR}" 44 | @echo "Bootstrap Lightbox successfully built at ${DATE}." 45 | @echo "${HR}\n" 46 | 47 | # 48 | # RUN JSHINT & QUNIT TESTS IN PHANTOMJS 49 | # 50 | 51 | test: 52 | @echo "\n${HR}" 53 | @echo "Running Bootstrap Lightbox Tests..." 54 | @echo "${HR}\n" 55 | @./node_modules/.bin/jshint js/*.js --config js/.jshintrc 56 | @echo "Running JSHint on javascript... ${CHECK} Done" 57 | @./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc 58 | @echo "Running JSHint on javascript tests... ${CHECK} Done" 59 | @cd js/tests/; phantomjs run-qunit.js index.html 60 | @echo "Running QUnit... ${CHECK} Done" 61 | 62 | # 63 | # MAKE FOR GH-PAGES 64 | # 65 | 66 | gh-pages: 67 | rm -f docs/assets/bootstrap-lightbox.zip 68 | zip -j docs/assets/bootstrap-lightbox.zip docs/assets/js/bootstrap-lightbox.js docs/assets/bootstrap-lightbox.zip docs/assets/js/bootstrap-lightbox.min.js docs/assets/bootstrap-lightbox.zip docs/assets/css/bootstrap-lightbox.css docs/assets/css/bootstrap-lightbox.min.css 69 | rm -rf ../bootstrap-lightbox-gh-pages/ 70 | node docs/build 71 | mkdir ../bootstrap-lightbox-gh-pages 72 | cp -r docs/* ../bootstrap-lightbox-gh-pages -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **THIS PLUGIN IS NO LONGER BEING MAINTAINED. IF SOMEONE ELSE WANTS TO MAINTAIN IT FEEL FREE TO FORK THE REPO.** 2 | 3 | [Bootstrap - Lightbox](http://jbutz.github.com/bootstrap-lightbox/) [](http://travis-ci.org/jbutz/bootstrap-lightbox) 4 | ================= 5 | 6 | This is a plugin for Twitter Bootstrap that adds a lightbox that is based off the modal dialog 7 | 8 | 9 | Quick start 10 | ----------- 11 | 12 | You have several options. You can clone the repository `git clone git://github.com/jbutz/bootstrap-lightbox.git`, grab an [archive](https://github.com/jbutz/bootstrap-lightbox/tags), or use [cdnjs](http://cdnjs.com/#bootstrap-lightbox). 13 | 14 | Once you have the files include the CSS and JavaScript files in your page and then give the example code below a shot. 15 | 16 | Example 17 | ----------- 18 | 19 | ```html 20 | Open Lightbox 21 |
31 | ``` 32 | 33 | Usage 34 | ----------- 35 | 36 | ### Via data attributes ### 37 | 38 | 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. 39 | ```html 40 | Open Lightbox 41 | ``` 42 | 43 | ### Via JavaScript ### 44 | 45 | Open the lightbox with the id `myLightbox`. 46 | ```javascript 47 | $('#myLightbox').lightbox(options) 48 | ``` 49 | 50 | ### Options ### 51 | 52 |Name | 56 |Type | 57 |Default | 58 |Description | 59 |
---|---|---|---|
backdrop | 64 |boolean | 65 |true | 66 |This adds a modal-backdrop element. | 67 |
keyboard | 70 |boolean | 71 |true | 72 |Pressing escape closes the lightbox. | 73 |
show | 76 |boolean | 77 |true | 78 |Shows the lightbox when initialized. Note: This only applies when using JavaScript to setup the lightbox. |
79 |
resizeToFit | 82 |boolean | 83 |true | 84 |This resizes the image to fit the window if the image is too large. | 85 |
A simple lightbox plugin based on the bootstrap modal plugin.
43 | 44 |Click the thumbnail below to open the lightbox. This demo includes the optional .lightbox-caption
element, which adds an image caption.
<div id="demoLightbox" class="lightbox fade" tabindex="-1" role="dialog" aria-hidden="true"> 90 | <div class='lightbox-dialog'> 91 | <div class='lightbox-content'> 92 | <img src="image.png"> 93 | <div class="lightbox-caption"><p>Your caption here</p></div> 94 | </div> 95 | </div> 96 | </div> 97 |98 | 99 |
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>110 | 111 |
Open the lightbox with the id myLightbox
.
$('#myLightbox').lightbox(options)114 | 115 |
Name | 120 |Type | 121 |Default | 122 |Description | 123 |
---|---|---|---|
backdrop | 128 |boolean | 129 |true | 130 |This adds a modal-backdrop element. | 131 |
keyboard | 134 |boolean | 135 |true | 136 |Pressing escape closes the lightbox. | 137 |
show | 140 |boolean | 141 |true | 142 |Shows the lightbox when initialized. Note: This only applies when using JavaScript to setup the lightbox. |
143 |