function writeScroll() { document.write('
'); var x = 0; var stayScroll = new YAHOO.util.Scroll('bandeauScroller', {scroll: { by: [0, 0] }},2); var animScroll = new YAHOO.util.Scroll('bandeauScroller', {scroll: { by: [0, 42] }},2); var initScroll = new YAHOO.util.Scroll('bandeauScroller', {scroll: { to: [0, 0] }},0); YAHOO.util.Event.on(window, 'load', function() { stayScroll.animate(); }); stayScroll.onComplete.subscribe(function() { if(x>=4){ x=0; initScroll.animate(); }else{ x+=1; animScroll.animate(); } }); animScroll.onComplete.subscribe(function() { stayScroll.animate(); }); initScroll.onComplete.subscribe(function() { x+=1; animScroll.animate(); }); }