Developed for MyOwnDB, you web database

YUI-based Slideshow

Prerequisites

You'll need the Yahoo UI library, available here. You'll need to load these files: yahoo.js, dom.js, event.js, connection.js (for remote html slides) and animation.js.

You can then simply include the slideshow.js and slideshow.css files available on the download page.

Markup

Container

The container of the slideshow is a simple div with the class yui-sldshw-displayer. For some reasons, in the demonstration on the front page I had to specify inline style for the container, like this:

 <div id="yui-sldshw-displayer2" class="yui-sldshw-displayer" style="height:300px;width:350px;">

Slides

Slides defined in the page are

Remote HTML content is put in a containing div when loaded. Remote images loaded on demand have class applied to them prior to their insertion in the DOM tree.

Javascript

The slideshow is contrusted by instanciating the class YAHOO.myowndb.slideshow. The constructor takes 2 arguments: Remote slide objects have 3 fields: Here is how the slideshow on the homepage was defined:
slideshow2 = new YAHOO.myowndb.slideshow("yui-sldshw-displayer2",
			{ frames: [ { type: 'remote_html', value: 'http://www.madb.net/slideshow/remoteslide.html', id: "re1"}],
			  effect: YAHOO.myowndb.slideshow.effects.slideRight
			}
			);
You can start the looping by calling the loop method, like this:
slideshow2.loop()

New effects

Effects are simple objects with following fields: Here is the definition of the slideUp effect:
YAHOO.myowndb.slideshow.effects.slideUp={
			setup: function(frame){
					YAHOO.util.Dom.setStyle(frame, 'top', '0'); 
					YAHOO.util.Dom.setStyle(frame, 'left', '0'); 
			},
			get_animation: function(frame){
					region = YAHOO.util.Dom.getRegion(frame);
					return new YAHOO.util.Motion(frame, { points: { by: [0,region.top-region.bottom] } }, 1, YAHOO.util.Easing.easeOut);
			}
}
				

Changelog

0.3