Quantcast
Viewing all articles
Browse latest Browse all 28

Re: AutoPlay on YUI3 Carousel

Got it - here is the code for autoplay on YUI3 Carousel
Code:
YUI({gallery: 'gallery-2011.03.23-22-20'}).use("gallery-carousel", "substitute", "gallery-carousel-anim",  function (Y) {
   //add startAutoPlay method to Carousel widget's prototype
   Y.Carousel.prototype.startAutoPlay = function() {
      var B = this;
      u = B.get("autoPlayInterval");
      setInterval (doScrollForward, u);
      function doScrollForward() {
        B.scrollForward();
      }
   }

   Y.on("contentready", function () {
      var carousel = new Y.Carousel({
         boundingBox: "#gallery-carousel",
         numVisible: 1,         
         isCircular: true,
         autoPlayInterval: 2000,
         contentBox: "#gallery-carousel > ul"
      });
      
        carousel.plug(Y.CarouselAnimPlugin, { speed: 1, effect: Y.Easing.easeOut } );
        carousel.render();
        carousel.startAutoPlay();
      
      var carouselNode = Y.one('#gallery-carousel li.first').removeClass('first');
      
   }, "#footer");   
});

Viewing all articles
Browse latest Browse all 28

Trending Articles