This is an ActionView helper to create a simple jQuery slideshow. You pass in an image directory (relative to public/images/) and the jquery_slideshow method generates a slideshow that loops every image in that directory.
- jQuery 1.2.6+ (probably works with earlier version – please let me know of any compatibility issues)
- Some added css (specifically, slideshow.css in public/stylesheets)
- If you did a “script/plugin install”, slideshow.css was copied to your public/stylesheets directory
Use the default options
To avoid conflicts with prototype
Use a collection of Paperclip photos.
<% @photo_collection.each do |photo| >
<= image_tag(photo.image.url) >
< end %>
Note the use of the
:selectorallows you to use a different DOM selector to advance the “slides” (the default is simply ‘img’), while
:wrap_idallows you to set the the wrapping element – in this case ‘gallery’ – whatever you want. (Keep in mind that if you change these selectors, you will need to update the CSS accordingly, or the effect will not render properly.)
- Add tests
- Search recursively through a directory for images
- Allow an option to pass of an array of image paths
- Provide more flexibility for how the directory containing the images is found.
- Allow an array of paperclip image attachment objects to be passed in.
- Allow a non-infinite loop option
- Add support for transitions triggered by a click event of a dom object, rather than a timed cycle.
- Allow for different types of transition effects (slide up/down, slide left/right, etc.)
Copyright © 2008 Alex Sharp, released under the MIT license