Lightbox Plus

What's this?

27th Oct 2006

Lightbox JS is very cool and useful script to display an image on the page.

However only the part of the image is displayed when the image size is larger than the window size. So I've created a script based on Lightbox JS.

Samples

sample 1 sample 2 sample 3

Feature

The image is expandable when the image size is larger than the current window size. The image is resized automatically to suit to the current window size. The echoic word image can be applied. The zoom ratio can be changed by mouse wheel. The zoomed image can be dragged.

How to use

This script can be used in much the same way as Lightbox JS.

Include spica.js and lightbox_plus.js in header. Please make sure "spica.js" first.
<script type="text/javascript" src="spica.js"></script>
<script type="text/javascript" src="lightbox_plus.js"></script>

Add rel="lightbox" attribute to any link tag to activate the lightbox.

Customize

At the end of "lightbox_plus.js",

addEvent(window,"load",function() {
  var lightbox = new LightBox({
    loadingimg:'loading.gif',
    expandimg:'expand.gif',
    shrinkimg:'shrink.gif',
    previmg:'prev.gif',
    nextimg:'next.gif',
    effectimg:'zzoop.gif',
    effectpos:{x:-20,y:-20},
    effectclass:'effectable',
    closeimg:'close.gif',
    resizable:true
  });
});

images, which are used in Lightbox Plus, are indicated.

So you can change these when the images are changed or put on the different directory.

The default settings are set like above on the premise that html files, "lightbox_plus.js", and all images are put on the same directory. So I recommend to change it as absolute path, like "http://serennz.sakura.ne.jp/toybox/lightbox/resource/loading.gif".

effectimg indicates url of an echoic word image, effectpos indicates position of the image, effectclass indicates class attribute to apply an echoic word image.

When effectclass has no value but effectimg has a valid value, all lightbox images are displayed with an echoic word image. When effectclass is valid, an echoic word image is displayed for the same class.

For example, when the setting set as "effectclass:'effectable'", the following anchor could be displayed with the echoic word image.

<a href="[...image...]" rel="lightbox" class="effectable">****</a>

Set "resizable" as false if you want to turn off mouse wheel feature.

FAQ

Animated image for loading is not displayed.
Path settings at the end of lightbox_plus.js are probably incorrect. So please check these using example from customize.
Animated image for loading is display at the right edge of the window.
text-align:center is probably set against main content element such as <body> tag. So please change a property of #overlay on your lightbox.css, as follows:
#overlay {
  text-align: left;
  background-image: url(overlay.png);
}
Animated image for loading is still displayed after finishing loading.
Please update your lightbox_plus.js.

Download

Download Sample

Contact

Don't hesitate to contact me if you have any question about it.

takuya.otani@gmail.com

Thank you for your visiting. I hate to inconvenience you but my reply may delay.

History

04 Apr 2007
uploaded sample archive
27 Oct 2006
fixed a bug (not work on Netscape 7)
26 Oct 2006
fixed some bugs
11 Oct 2006
implemented image sets feature
20 Sep 2006
implemented overall view
18 Sep 2006
implemented Mouse wheel & image drag'n drop features
28 Jan 2006
implemented functionality of echoic word.
20 Jan 2006
implemented functionality of caption and close button.
15 Jan 2006
first release.
Copyright © 2006 SerendipityNZ Ltd. All rights reserved.


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser