Skip to main content

Carousel allows you to add user-configurable rotating banners to any section of a Plone site.

Project description


Carousel is a tool for featuring a rotating set of banner images in any section
of your Plone site. Features:

* Different sets of banners can be used in different sections of the site.

* Banners can link to another page in the site, or an external URL.

* Carousel provides options to customize the appearance of the banner as well
as the length and type of transition.

* An optional pager provides navigation among the banners.

* Transition effects are implemented using the jQuery javascript library which
is included with Plone, so they are pretty lightweight.

* Banners do not rotate while the mouse cursor is hovering over the Carousel.

* Banner and pager templates can be registered to customize the appearance of
the Carousel.

* Carousel implements jQuery events, allowing for integration with custom


Carousel requires Plone 3.0 or greater, mainly because it renders itself in a


Add Products.Carousel to your buildout's list of eggs, and re-run buildout.

Start Zope, go to Site Setup -> Add-on Products in your Plone site and
install the Carousel product.

Using Carousel

A `detailed guide to using Carousel <>`_
is available.

Detailed overview and tests

Configuring a Carousel banner folder

The items displayed by Carousel are known as "Carousel Banners" and can exist
within a "Carousel Folder" in any section of the site. For purposes of
demonstration, let's add a Carousel folder to the root of the site.

Carousel folders are a matter of configuration more than content, so they don't
appear on the Add menu. Instead, there is a 'Carousel' tab. Clicking
it within a section that doesn't yet have a Carousel folder will result
in the creation of a new one::

>>> browser.getLink('Carousel').click()
>>> browser.url

The new folder should now provide the ICarouselFolder interface::

>>> from Products.Carousel.interfaces import ICarouselFolder
>>> ICarouselFolder.providedBy(self.portal.carousel)

If, on the other hand, we're in a folder that already has a Carousel folder,
the existing one will be used::

>>> browser.goBack()
>>> browser.getLink('Carousel').click()
>>> browser.url

And if we try to configure Carousel while we're already doing so, nothing
should change::

>>> browser.getLink('Carousel').click()
>>> browser.url

Adding a Carousel banner

Now that we're within the Carousel folder, we can add a Carousel banner using
the add menu::

>>> browser.getLink('Carousel Banner').click()
>>> browser.url

We can set various things including a title, target URL, and image::

>>> browser.getControl('Title').value = 'Pirates and Cowboys agree: Ninjas suck'
>>> browser.getControl('URL').value = ''
>>> browser.getControl(name='image_file')
<Control name='image_file' type='file'>
>>> browser.getControl('Save').click()
>>> 'Changes saved.' in browser.contents

We need to publish the new banner.
>>> browser.getLink('Publish').click()

Viewing the banners

Now if we return to the home page, where we initially configured the banners,
the banner we just added should be rendered (*before* the tabs)::

>>> browser.contents
...Pirates and Cowboys...

Adding banners in other scenarios

Non-structural folder: put the carousel in the containing folder::

>>> self.setRoles(['Manager'])
>>> self.portal.invokeFactory('Folder', 'nonstructural')
>>> from zope.interface import alsoProvides
>>> from Products.CMFPlone.interfaces import INonStructuralFolder
>>> alsoProvides(self.portal.nonstructural, INonStructuralFolder)
>>> browser.getLink('Carousel').click()
>>> browser.url

Collection, not default item: put the carousel in the collection itself::

>>> self.portal.invokeFactory('Topic', 'topic')
>>> browser.getLink('Carousel').click()
>>> browser.url

Collection, as default item: put the carousel in the containing folder::

>>> self.portal.default_page = 'topic'
>>> browser.getLink('Carousel').click()
>>> browser.url

Customizing Carousel

It is possible to customize presentation of the Carousel by registering custom
templates for the banner and pager. To simplify the registration of Carousel
templates and their associated menu items, Carousel includes special
ZCML directives. To begin, define the Carousel XML namespace in your product's


Then load the ZCML for Carousel::

<include package="Products.Carousel" />

Finally, register your templates::


title="Title and Text"

Both the banner and pager directives can also accept a layer attribute to
restrict the availability of the template to a particular browser layer.

To make the development of banner and pager templates less repetitive,
Carousel includes macros in the banner-base and pager-base templates. See and for examples of how to use these macros.

Carousel Events

Carousel triggers jQuery events at key points in its operation, making it
possible to integrate Carousel with other interactive elements on the page.
These events are triggered on the Carousel container element:

Triggered immediately before animation begins. It passes as parameters the
Carousel object, the index of the previous banner and the index of the
current banner.

Triggered immediately before animation begins. It passes as parameters the
Carousel object, the index of the current banner and the index of the
banner that will be active at the end of the animation.

Triggered when animation is paused, such as when the user mouses over
the Carousel. It passes as its parameter the Carousel object.

Triggered when animation begins or resumes. It passes as its parameter the
Carousel object.

The Carousel object, which is passed as the first optional parameter to event
handlers, is a Javascript object that encapsulates the current state of the
Carousel. See carousel.js for details of the Carousel object.

To bind a callback to one of the Carousel events, select the Carousel container
element and call the jQuery bind method on it::

(function ($) {
function (event, carousel, old_index, new_index) {

Change history


2.0 (2010-11-19)

- Split plugin into functions, making it easier to override parts of the
Carousel behavior.

2.0b1 (2010-09-30)

- Added slide as a possible transition type.

- Refactored javascript as a jQuery plugin that triggers jQuery events on

- Added settings to customize the appearance of the banner and pager and the
length and type of transition.

- Added an optional pager for navigation among banners.

- Replaced description field on Carousel banners with a rich-text body field.

- Remove the browser layer to help with use in Plone 2.5.

1.1 (2010-03-26)

- In Plone 4, add viewlet to the abovecontent viewlet manager by default, to
avoid weird styles.

- Added Spanish translation.

- Only show published banners in the Carousel, even for users who have
permission to see others.

1.0 (2009-03-31)

- Changed behavior of text links to swap banner on mouseover.

1.0b3 (2009-02-07)

- Add 'Carousel Banner' to types not searched.

- Locate carousel folder correctly on containers used as default pages
(e.g. a Topic)

- Apply proper security declarations to the getSize and tag methods of the
banner type so that the view works okay when customized TTW.

- Only display the carousel on default view; not any of the other tabs.

- Fix viewlet removal on uninstallation.

- Fix duplicate entries in quick installer.

1.0b2 (2009-02-04)

- Declare dependency of our custom GS import step on the viewlets step.

- Separate the (globally-registered) template from the (locally-registered)
viewlet, so that the former can be customized using

- Added banner description to the template. Changed the 'carousel-title'
class to 'carousel-button' so I could split out 'carousel-title' and

- Handle non-structural folders correctly.

1.0b1 (2009-02-03)

- Initial release.


* David Glick [davisagli], Groundwire, Author
* Matt Yoder [yomatters], Groundwire

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution (61.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page