Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.56 KB  |  hits: 11  |  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. window.addEvent('domready',function() {
  2.         var list = $('latest-news').getFirst('ul');
  3.         var items = list.getElements('li');
  4.         var showDuration = 3000;
  5.         var scrollDuration = 500;
  6.         var index = 0;
  7.         var height = items[0].getSize().y;
  8.         var move = function() {
  9.                 list.set('tween',{
  10.                         duration: scrollDuration,
  11.                         onComplete: function() {
  12.                                 if(index == items.length - 1) {
  13.                                         index = 0 - 1;
  14.                                         list.scrollTo(0,0);
  15.                                 }
  16.                         }
  17.                 }).tween('top',0 - (++index * height));
  18.         };
  19.         window.addEvent('load',function() {            
  20.                 move.periodical(showDuration);
  21.         });
  22. });