BarackSlideshow – An elegant, lightweight slideshow script

This post discusses a project which has its own page. Please refer to BarackSlideshow for the most up-to-date information.

Demo

I guess pretty much everyone has seen Barack Obama’s website by now, which is clearly one of the prettiest of all candidates we’ve heard of so far. Not only is it an example of state-of-the-art design, but it’s also nice to navigate and interact with.

I decided to imitate the homepage slideshow. I had already experimented with similar animated lists, which allowed me to have it ready within minutes

The creation

I took my previous class (SlideList), and made a few changes here and there. It works with MooTools 1.2, and supports all kinds of shape transformations (top and left coordinates, and height and width properties), which means it can now be used with vertical, horizontal, or even irregular lists.

I extended it and came up with a new class that receives the images and loading spinner as parameters (note: it’s arguable whether this is the best decision OOP-wise, but due to the simplicity of this script, this was the right call)

The code

To ensure all images are loaded before the user makes any interaction, the MooTools Assets component is used.

The CSS plays a major role (as in every other animation-focused script). I suggest you analyze it carefully before implementing it in your applications or websites. You’ll probably need to adjust the ids, or use classes instead to keep your stylesheets clean.

The markup is meaningful and simple. Two lists are used (one for the images and the other for the links). The loading element is included in the HTML, but it’s probably better to inject it from the script directly.

The pictures

The beautiful pictures were taken from Flickr with permission of the owners, unless they were directly released for non-commercial use. Thanks vgm8383, dogonnit, M. TANIGUCHI, GustavoBuriola & others!

The demo

Click here to see it in action or go to the project page for download and other details.

Displaying only a subset of the comments. Click here to display all comments.

  1. Great looking Slideshow. Thank you.
    I just read through all the comments and… for the future:
    why not provide the people with a list of dependences and perhaps a link to where they can get them (in the case of mootools-1.2.2.2-core.js and mootools-1.2.2.2-more.js directly from the moo-homepage). That would have made half of the postings unneccessary. Also, a short hint on the demo page that the people should not initialize the slideshow with the demo.js they find there but have to use the js-snippet on the introduction page to make it work as intended would avoid a lot of misunderstanding.
    Aside of that, I love the look of your slideshow and will definately use it in my next project. Probably together with the lavalamp menu which I only knew of JQuery before. Only today did I find out that the JQuery scipt is based on your code. Great work!.