Sunday, 19 June 2011

Spotlight & Preview - Carousel

Illustrates how to spotlight the middle item in the carousel. Several techniques illustrated:
  • Highlight the middle item by switching between a style class 'non-spotlight' (all other visible items have this class) with the style class 'spotlight')
  • To accomplish the offset start (so that item 1 starts in the middle) set scrollBeforeAmount to 2 and scrollAfterAmount to 2. This will allow scrolling between -1 and 17, yet loads only happen from 1 to 15 (size). Also the firstVisible is set to -1.
  • The slight bounce is accomplished by setting the animationMethod to YAHOO.util.Easing.backBoth.
  • carousel.addItem() now allows a third parameter: itemClass that we initially set to 'non-spotlight'
  • When the user hits next or previous we turn off the spotlight (switching classes) for the previous middle (which is actually the previous firstVisible -- carousel.priorFirstVisible) and highlight the new one
  • Clicking on an image in the carousel will scroll to the item and show it in the preview.

Version 0.6.3 - 08/18/08
  • Upgraded demos to use YUI 2.5.2.
  • Removed extraneous includes for YUI library from demos.
  • Retested on all browsers.




No comments:

Post a Comment

All Time Popular Posts