Library: fader.js
Overview
Widget.Fader
Loads an array of images and fades them in and out in sequence.

Requires Prototype 1.6 (http://www.prototypejs.org) or later
and Scriptaculous 1.8 (http://script.aculo.us) or later.

Widget.Fader is licensed under the Creative Commons Attribution 2.5 South Africa License
(more information at: http://creativecommons.org/licenses/by/2.5/za/)
Under this license you are free to
- to copy, distribute and transmit the work
- to adapt the work
However you must
- You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
- That is by providing a link back to http://www.eternal.co.za or to the specific script page. This link need not be on the page using the script, or even nescessarily even on the same domain, as long as it's accessible from the site.
I'd also like an email telling me where you are using the script, although this is not required. More often than not I will link back to the site using the script.
Other than that, you may use this class in any way you like, but don't blame me if things go
pear shaped. If you use this library I'd like a mention on your website, but
it's not required. If you like it, send me an email. If you find bugs, send
me an email. If you don't like it, don't tell me: you'll hurt my feelings.

Change History:
Version 1.2.0: 11 Feb 2007
- Fixed a bug: minified version of Prototype broke Ajax (see http://www.eternal.co.za/blog/?p=50)
- Added builder option and imageBuilder (so that default behaviour does not change)
- Added textBuilder
- Updated included Prototype to 1.6.0.2
Version 1.1.1: 17 Nov 2007
- Fixed a bug: options.attributes should have been an associative array object
Version 1.1.0: 11 Nov 2007
- Updated script for Prototype 1.6 and Scriptaculous 1.8
- Fader is now in the Widget namespace (Widget.Fader).
- Fader no longer requires Scriptactulous Builder and uses Prototypes new Element(...) instead.
- Minified script and minified single script files added to download.
- New license: Creative Commons Attribution 2.5 South Africa License.
see more at: http://creativecommons.org/licenses/by/2.5/za/
- new Fader(...) has been deprecated and will be removed in the next major version
Version 1.0.2: 20 Sep 2007
- Added dir option
- Added beforeFade callback option
- Added startIndex option
Version 1.0.1: 15 Aug 2007
- Added attributes option
- Now requires builder.js from Scriptaculous
- Fixed a bug that started the blend with the 3rd image in the list
Version 1.0.0: 11 Aug 2007
- First version
  • source: fader.js
  • class: Widget.Fader
  • version: 1.2.0
  • author: Marc Heiligers marc@eternal.co.za http://www.eternal.co.za
Constructors
Widget.Fader(img, list, options)
The Widget.Fader class constructor.
parameters
string, img element img The id of or actual image element to be faded
array(string) list An array of paths (relative or absolute) of the images
object options? An object of options.
Widget.Fader.initialize.options(id, fadeInDuration, fadeOutDuration, displayDuration, autoSize, autoStart, attributes, dir, beforeFade, startIndex, builder)
The default options object.
parameters
string id? The id used as queue scope. (default: img.id)
float fadeInDuration? The time in seconds of the fade in. (default: 2.5)
float fadeOutDuration? The time in seconds of the fade out. (default: 1.5)
float displayDuration? The time in seconds that the image is not faded out after being faded in. (default: 2.5)
bool autoSize? Set true if the image should be sized to it's container. Maintains aspect ratio. (default: false)
bool autoStart? If false the Blender will not start until Blender#start is called. (default: true)
object attributes? An associative array of attributes given to the image. (default: {})
string dir? The directory that all images reside in. Used as a prefix for the image src. (default: null)
function beforeFade? A function that is called before the image is faded. 2 parameters are passed: 1. the image; 2. a boolean indicating if the image is being faded in (true) or out (false) (default: null)
int startIndex? The index of the first new image to be shown. (default: 0)
function builder? The function called to build the items. (default: Widget.Fader.imageBuilder)
Fader() deprecated
Namespaces
Functions
Widget.Fader.start()
Starts the fading if the autoStart option was set to false or after a call to stop.
Widget.Fader.stop()
Stops the fading and sets the opacity of the current image to 100%.
Widget.Fader.imageBuilder(fader, item, loaded)
Builds an image item out the item passed by fader. This is the default builder.
parameters
object fader The calling Widget.Fader
object item The current item
object loaded A callback bound to the fader for when the item has loaded.
Widget.Fader.textBuilder(fader, item, loaded)
Builds div containing the text from the item passed by fader. The Widget.Fader.options.dir is ignored.
parameters
object fader The calling Widget.Fader
object item The current item
object loaded A callback bound to the fader for when the item has loaded.
Objects
Generated by JsDoc Toolkit 1.4.1b on Mon, 11 Feb 2008 07:27:12 GMT.