Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 6th, 2010  |  syntax: JavaScript  |  size: 0.95 KB  |  views: 135  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. YAHOO.widget.Carousel.prototype._autoScroll = function() {
  2.     var carousel  = this,
  3.         currIndex = carousel._firstItem,
  4.         index, currPage, newPage;
  5.  
  6.     if (currIndex >= carousel.get("numItems") - 1) {
  7.         if (carousel.get("isCircular")) {
  8.             index = 0;
  9.         } else {
  10.             carousel.stopAutoPlay();
  11.         }
  12.     } else {
  13.         currPage = carousel.getPageForItem(currIndex);
  14.         index = currIndex + carousel.get("scrollIncrement");
  15.         newPage = carousel.getPageForItem(index);
  16.     }
  17.  
  18.     if (currPage != newPage) {
  19.         carousel._selectedItem = carousel._getSelectedItem(index);
  20.         carousel.scrollTo.call(carousel, index);
  21.     } else {
  22.         carousel.selectNextItem();
  23.         // because of a bug in scrollTo
  24.         clearTimeout(carousel._autoPlayTimer);
  25.         delete carousel._autoPlayTimer;
  26.         if (carousel.isAutoPlayOn()) {
  27.             carousel.startAutoPlay();
  28.         }
  29.     }
  30. }
clone this paste RAW Paste Data