My favorites | Sign in
Logo
                
Search
for
Updated Mar 16, 2009 by aeron.glemann
Labels: Featured, Phase-Implementation
Slideshow  
Documentation

Looking for help? Please post your questions to the Slideshow Google Group!

Method: constructor

Creates an instance of the Slideshow class. Applied to an existing element(s) in the HTML. Can parse in existing images, alt attributes, thumbnails, etc. or create as necessary.

Syntax:

var myShow = new Slideshow(element, data, options);

Arguments:

  1. element - (element) The wrapper element.
  2. data - (array or object) The images and optional thumbnails, captions and links for the show.
  3. options - (object) The options below.

Options:

Returns:

Examples:

var data = {
  // In this case no thumbnail has been specified so Slideshow will generate the thumbnail filename from the image using the RegExp defined in the replace option
  '1.jpg': {
    caption: 'Keylin', 
    href: 'keylin.html'
  },
  // Here the image and thumbnail use the same filename but different directories and an example of captions with HTML
  'images/2.jpg': {
    caption: '<em>Gustavo</em>', 
    href: 'gustavo.html',
    thumbnail: 'thumbs/2.jpg'
  },
  // In this example the image and thumbnail use absolute filenames
  'http://images.mysite.com/images/3.jpg': {
    caption: 'Amalia',
    thumbnail: 'http://images.mysite.com/thumbs/2.jpg'
  }
};
<div id="my_show" class="slideshow">
  <img src="1.jpg" alt="Keylin" />
</div>

<script type="text/javascript">
  var data = ['1.jpg', '2.jpg', '3.jpg'];

  var myShow = new Slideshow('my_show', data, {href: 'portfolio.html', hu: 'images/'});
</script>
<div id="my_show" class="slideshow">
  <img src="1.jpg" alt="Keylin" />
</div>

<script type="text/javascript">
  var data = {'1.jpg': {caption: 'Keylin', href: 'keylin.html'}, '2.jpg': {caption: 'Gustavo', href: 'gustavo.html'}, '3.jpg': {caption: 'Amalia', href: 'amalia.html'}};

  var myShow = new Slideshow('my_show', data, {captions: true, controller: {duration: 1000, transition: Fx.Transitions.Elastic.easeOut}, hu: 'images/'});
</script>
<div id="my_show" class="slideshow">
  <a rel="lightbox" href="1.jpg"><img src="1.jpg" alt="Keylin" /></a>
</div>

<script type="text/javascript">
  var data = ['1.jpg', '2.jpg', '3.jpg'];

  var myShow = new Slideshow('my_show', data, {controller: true, hu: 'images/', linked: true});
</script>

Notes:

  • 1 Captions, controller, loader and thumbnails all accept either a boolean (true / false) or Fx options object to customize element effect. In the case of the loader, the object also accepts an additional attribute 'animate' with the value an array consisting of a filename and frame count. Things get a little more complicated here: the filename should use the '#' symbol to indicate frame number. For example, the default value: { 'animate': ['../css/loader-#.png', 12] } assumes there are 12 images at the path indicated named loader-0.png through loader-11.png. The purpose of all this is for the loader to animate a series of PNG images in place of the usual animated GIF (which cannot blend with the images in the Slideshow). Assuming you are using a series of PNG images Slideshow will automatically apply the correct filters for Internet Explorer 6.
  • 2 Centering will not work as anticipated if the CSS classes used to define the effects of the show include absolute positioning. For this reason, it is recommended to use image margins to animate slide changes. For a demonstration, please consult the example.
  • 3 Internally the classes are in the following order: [ 'Slideshow', 'first', 'prev', 'play', 'pause', 'next', 'last', 'controller', 'thumbnails', 'captions', 'images', 'hidden', 'visible', 'inactive', 'active', 'loader' ]. Therefore if you wanted to change the name of the classes used for the controller (which also affects the HTML titles used for the controls themselves) you would set: classes: ['', 'primero', 'anterior', 'comenza', 'pausa', 'proximo', 'ultimo']. Class names left empty or not specified will use the Slideshow defaults.

Method: load

Loads a new data set into the show: will stop the current show, rewind and rebuild thumbnails if applicable.

Syntax:

myShow.load(data);

Arguments:

  1. data - (array or object) The images and optional thumbnails, captions and links for the show.

Returns:

Method: destroy

Destroys the current slideshow instance: removes global events, clears callbacks, frees memory.

Syntax:

myShow.destroy(p);

Arguments:

  1. p - (string) Optional parameter indicating desired action for existing show HTML. Upon destruction the dynamic HTML of a show becomes static, non-interactive. Call destroy with the parameter empty to remove all existing HTML inside of the show - useful to then apply a new Slideshow instance to the same wrapper element. Call destroy with the parameter dispose to remove all existing HTML and the wrapper element - useful to completely remove a Slideshow instance from the page.

Method: first

Goes to the first image in the show.

Syntax:

myShow.first();

Method: prev

Goes to the previous image in the show.

Syntax:

myShow.prev();

Method: pause

Toggles play / pause state of the show.

Syntax:

myShow.pause(p);

Arguments:

  1. p - (undefined, 1 or 0) Call pause with no arguments to toggle the pause state. Call pause(1) to force pause, or pause(0) to force play.

Method: next

Goes to the next image in the show.

Syntax:

myShow.next();

Method: last

Goes to the last image in the show.

Syntax:

myShow.last();

Method: go

Jump directly to a slide in the show.

Syntax:

myShow.go(n);

Arguments:

  1. n - (integer) The index number of the image to jump to, 0 being the first image in the show.

Hosted by Google Code