Lightbox JS is a simple, unobtrusive script used to overlay images on the current page. It's a snap to setup and works on all modern browsers.
Note: An new version of this script is available: Lightbox JS v2.0
Places images above your current page, not within. This frees you from the constraints of the layout, particularly column widths.
Keeps users on the same page. Clicking to view an image and then having to click the back button to return to your site is bad for continuity (and no fun!).
lightbox.js
in your header.
<script type="text/javascript" src="lightbox.js"></script>
rel="lightbox"
attribute to any link tag to activate the lightbox. For example:
<a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a>
Optional: Use the title
attribute if you want to show a caption.
#lightbox{
background-color:#eee;
padding: 10px;
border-bottom: 2px solid #666;
border-right: 2px solid #666;
}
#lightboxDetails{
font-size: 0.8em;
padding-top: 0.4em;
}
#lightboxCaption{ float: left; }
#keyboardMsg{ float: right; }
#lightbox img{ border: none; }
#overlay img{ border: none; }
#overlay{ background-image: url(overlay.png); }
* html #overlay{
background-color: #000;
back\ground-color: transparent;
background-image: url(blank.gif);
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="overlay.png", sizingMethod="scale");
}
lightbox.js
file.
var loadingImage = 'loading.gif';
lightbox.js
file.
var closeButton = 'close.gif';
1/19/06 10:40PM EST - Added keypress activated closing.
1/15/06 12:50PM EST - Added optional 'close' button.
1/10/06 10:30PM EST - Added support for captions.
12/31/05 6:00PM EST - Fixed IE6 bugs.
<body onload="MM_preloadImages(‘/images/menu_on.gif’)…;">
initLightbox()
to the onload attribute as so:<body onload="MM_preloadImages(‘/images/menu_on.gif’)…;initLightbox()">
body{ margin: 0; padding: 0; }
to your stylesheet.filter: progid:DXI…
line that you added to your stylesheet. There is a reference to the overlay.png in this line. Make sure that it is set relative to the current webpage, not relative to the CSS file.If you are having problems with the script, please check the forum for help.. Thanks.