Introducing gallery-slideshow for YUI3

2 Comments No TrackBacks

Recently, at work, we had a desire to update an instance of a flash-based slideshow widget on our commencement website. This widget did absolutely nothing special, but the real problem we had was that, we didn’t actually have a license for Flash, and the way the slideshow had been built, we needed to be able to build the SWF file from scratch in order to update the order. Since our users rarely come to us with anything that isn’t some sort of emergency, we had to take the flash files to another department to make our quick change and compile a new SWF.

Of course, I knew there was no reason to continue to use unconfigurable Flash for this, but YUI didn’t have a slideshow widget. So, I decided to start writing one. Due to the excellent widget framework, I had a quick-and-dirty example written in a mere couple of hours. Of course, that was not something I was really going to release, though I did push it up to my github.

It was about a week before I was able to return to the project, but I have now submitted a very basic, but functional widget to the Y! CDN.

The javascript to run the above slideshow is simple, for the user:

The CSS that it requires is straightforward, and is part of the widget’s assets:

The widget will automatically take care of placing the images in the upper-left hand corner of the widget’s content box, as well as cycling through all the images using the transition sent in via the animation configuration option.

The core of slideshow is mostly done at this point. I plan to add support for the an image to transition in, instead of only having the top image transition out. Most functionality will likely be added via the plugin framework. And I have several plugins planned.

  • Titles - Adds the widget header which will be populated with the ‘title’ value from the images array.
  • Descriptions - Like Titles, but in the footers. I’m thinking this will take either a string or a function to generate the content of the footer div.
  • Image Centering - This will center all the images in the content box, allowing the slideshow to consist of images of different sizes.
  • Image Navigation - Buttons (probably images with click events, but you get the idea) which will allow the user to force transition between images.

The plugin framework is great because it allows you to customize a widget with exactly the kind of features you need. There are a lot of other kinds of plugins that would be appropriate, and I’m certainly open to feature requests, or pull requests would be better!

Categories:

  • StumbleUpon Toolbar Stumble It!

No TrackBacks

TrackBack URL: http://blog.foxxtrot.net/cgi-bin/mt-tb.cgi/396

2 Comments

Hi Jeff,

This is great! I’d like to use something similar on my site but not being that proficient in web design I’m struggiling to do this.

I maintain a Moodle website which has uses YUI as its built-in JavaScript library and I’d love to do use your example on my site. The current lack of an image navigation feature is whats preventing me from doing it at the moment. I notice you said this feature is planned as a plugin do you know when this will be released?

Many thanks, Paul

Paul,

I haven’t taken the time to do that plugin yet. I have some time this coming weekend, and will look at implementing this.

Jeff

Leave a comment