Submit your widget

very cool and useful Lightbox JS

Created 8 years ago   Views 23897   downloads 4073    Author sakura
very cool and useful Lightbox JS
View DemoDownload 1.2 MB
151
Share |

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 original script (Idea is based on Lightbox JS, but I've created the script from scratch).

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.

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

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

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

"spica.js" was no longer needed since ver 20090707 because "lightbox_plus.js" contains basic functionality of "spica.js".

At the end of "lightbox_plus.js",

addEvent(window,"load",function() {
  var lightbox = new LightBox({
    loadingimg:'loading.gif',
    expandimg:'expand.gif',
    shrinkimg:'shrink.gif',
    blankimg:'blank.gif',
    previmg:'prev.gif',
    nextimg:'next.gif',
    closeimg:'close.gif',
    effectimg:'zzoop.gif',
    effectpos:{x:-20,y:-20},
    effectclass:'effectable',
    resizable:true,
    animation: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.

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.

You might also like