Crossfade slideshow reference manual

made by 8 Dimensions ©

Description & features

This JavaScript mini library purpose is to allow easy adding of a slideshow feature to a web page. It’s enough to fill an array with pictures and call two methods.

Public variables

Pic

slideShowSpeed

crossFadeDuration

startOpacityDegree

mapSwapOpacityDegree

 

Other variables are defined in the library. Their usage outside the library is not advised tough as it my compromise the correct behavior of the functions.

Public procedures

function writeSlideShowCode

Paremeters:

The function's return value - in case of DOM supporting browsers - is the object of slide show it created. It's useful to set up some additonal object properties for example.

This function must be called in the <BODY> section of the page at the place where the slideshow is to be displayed.

function initSlideShow

Paremeters:

This function must be called at least once for the slideshow to work correctly. It is advisable to call it in the onLoad event of the page.

function runSlideShow

This function is to manually start the slideshow, for example as a reaction to mouse movement over some region or mouse click on some element of the page.

The slideshow continues from the image currently showing, if it is a member of the array. Otherwise the slideshow continues with the image following the last one shown from the array.

The functions purpose is opposite of the stopSlideShow’s one.

function stopSlideShow

This function stops the slideshow, for example as a reaction to mouse movement over some region or mouse click on some element of the page.

The slideshow stops and the active image is made fully opaque if it’s not already.

The functions purpose is opposite of the runSlideShow’s one.

function showImage

Paremeters:

This functions shows the image specified in parameters covered by attached map (if supplied). The slideshow is stopped by this function. If the image is a member of the Pic array once the slideshow is restarted (by the function runSlideShow) it continues from the next image in the array, otherwise from the image following the last shown from the array.

function showImageByIndex

Paremeters:

This function shows the image from the Pic array identified by the parameter. The image is made fully opaque and the slideshow is stopped. If it’s rerun later on (using the function runSlideShow) it continues with the image following the one shown by this function.

function picRefresh

This function has to be called if any changes made in the Pic array after the call of initSlideShow are to be registered. If the slideshow is active at the moment of refresh it's stopped and restarted after the refresh. The restart of the slideshow shows the first image in the Pic array.

 

There are other functions in the library with names starting with “_”. They are not intended to be called from outside the library.

Usage

  1. Place the following code in the <HEAD> section of the page:

    <script type="text/javascript" language="JavaScript" src="Dim8_crfdsldeshow.js"></script>

  2. Fill the Pic array in the <HEAD> section of the page. Something like this:

    <script type="text/javascript" language="JavaScript">
    Pic[0]  = ['http://www.mysite.com/img01.jpg','#image1map',true];
    Pic[1]  = ['http://www. mysite.com/img02.jpg ','# image1map',true];
    Pic[2]  = ['http://www. yoursite.com/funny.jpg','# image2map',false];
    Pic[3]  = ['http://www. othersite.com/imges/cool.png', '',false];
    </script>

  3. Call the writeSlideShowCode function at the <BODY> section of the page at the place, where you want the slideshow to appear.

    <p><script type="text/javascript" language="JavaScript">writeSlideShowCode(620,380,"black");</script></p>

  4. Call the initSlideShow function; the advised place to do it is in the onLoad event of the page.

    <body ONLOAD="initSlideShow(-1,true)">

  5. (optional) You can stop or run the slideshow or change the image displayed depending on the events on the page calling the appropriate functions

Unfortunately the script does not support more then one slideshow per page. To have more frames or iframes have to be used.

Compatibility

Compatible

Limited compatibility

(no cross fade, direct change of images)

Tested on

Incompatible

 

The compatibility with other browsers depend whether they support DOM and opacity.

Version history

1.0 26.I.2007 The first version released
1.1 01.II.2007 fadebgcolor in writeSlideShowCode can be omitted now, no background then.
The image is changed only when URL differs (better for IE behavior).
1.2 15.II.2007 writeSlideShowCode function now returns a reference to the object it created (in DOM browser), so its various properties can be set.

Credits

The library was created by 8 Dimensions. Go to www.8dimensions.com to see more.

Big thanks goes to CodeLifter.com whose FadeIn_1_5 script was a big inspiration and source of ideas.