Lightbox v2.5.1 Demo
by Nate Balcom
HTML
<!--
Stackoverflow Question: http://stackoverflow.com/q/11682061/1195891
Answer by arttronics.
-->
<a href="http://lokeshdhakar.com/projects/lightbox2/images/examples/image-3.jpg">
<img class="thumb" src="http://lokeshdhakar.com/projects/lightbox2/images/examples/thumb-3.jpg" alt="gallery" title="Photo 1" />
</a>
<a href="http://lokeshdhakar.com/projects/lightbox2/images/examples/image-4.jpg">
<img class="thumb" src="http://lokeshdhakar.com/projects/lightbox2/images/examples/thumb-4.jpg" alt="gallery" title="Photo 2" />
</a>
<a href="http://lokeshdhakar.com/projects/lightbox2/images/examples/image-5.jpg">
<img class="thumb" src="http://lokeshdhakar.com/projects/lightbox2/images/examples/thumb-5.jpg" alt="gallery" title="Photo 3" />
</a>
CSS
body{
background-image:url("http://files.customize.org/thumbnails/larger/10302.jpg");
background-repeat: no-repeat;
margin: 10px;
}
.thumb {
border: 5px solid yellow;
margin-right: 5px;
}
/* line 6, ../sass/lightbox.sass */
#lightboxOverlay {
position: absolute;
top: 0;
left: 0;
z-index: 9999;
background-color: black;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=85);
opacity: 0.85;
display: none;
}
/* line 15, ../sass/lightbox.sass */
#lightbox {
position: absolute;
left: 0;
width: 100%;
z-index: 10000;
text-align: center;
line-height: 0;
font-family: "lucida grande", tahoma, verdana, arial, sans-serif;
font-weight: normal;
}
/* line 24, ../sass/lightbox.sass */
#lightbox img {
width: auto;
height: auto;
}
/* line 27, ../sass/lightbox.sass */
#lightbox a img {
border: none;
}
/* line 30, ../sass/lightbox.sass */
.lb-outerContainer {
position: relative;
background-color: white;
*zoom: 1;
width: 250px;
height: 250px;
margin: 0 auto;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
}
/* line 38, ../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.12.1/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */
.lb-outerContainer:after {
content: "";
display: table;
clear: both;
}
/* line 39, ../sass/lightbox.sass */
.lb-container {
padding: 10px;
}
/* line 42, ../sass/lightbox.sass */
.lb-loader {
position: absolute;
top: 40%;
left: 0%;
height: 25%;
width: 100%;
text-align: center;
line-height: 0;
}
/* line 51, ../sass/lightbox.sass */
.lb-nav {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 10;
}
/* line 59, ../sass/lightbox.sass */
.lb-container > .nav {
left: 0;
}
/* line 62, ../sass/lightbox.sass */
.lb-nav a {
outline: none;
}
/*...
JavaScript
$(document).ready(function() {
// Scan the webpage for all class names of 'thumb' that is seen.
$('.thumb').each(function(){
// For each class name of 'thumb' found, go to the parent item of that thumb and apply the rel attribute.
$(this).parent().attr('rel','lightbox[myGallery]');
});
});
/*
Lightbox v2.51
by Lokesh Dhakar - http://www.lokeshdhakar.com
For more information, visit:
http://lokeshdhakar.com/projects/lightbox2/
Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
- free for use in both personal and commercial projects
- attribution requires leaving author name, author link, and the license info intact
Thanks
- Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
- Artemy Tregubenko (arty.name) for cleanup and help in updating to latest proto-aculous in v2.05.
Table of Contents
=================
LightboxOptions
Lightbox
- constructor
- init
- enable
- build
- start
- changeImage
- sizeContainer
- showImage
- updateNav
- updateDetails
- preloadNeigbhoringImages
- enableKeyboardNav
- disableKeyboardNav
- keyboardAction
- end
options = new LightboxOptions
lightbox = new Lightbox options
*/
(function() {
var $, Lightbox, LightboxOptions;
$ = jQuery;
LightboxOptions = (function() {
function LightboxOptions() {
this.fileLoadingImage = 'http://lokeshdhakar.com/projects/lightbox2/images/loading.gif';
this.fileCloseImage = 'http://lokeshdhakar.com/projects/lightbox2/images/close.png';
this.resizeDuration = 700;
this.fadeDuration = 500;
this.labelImage = "Image";
this.labelOf = "of";
}
return LightboxOptions;
})();
Lightbox = (function() {
function Lightbox(options) {
this.options = options;
this.album = [];
this.currentImageIndex = void 0;
this.init();
...