function writeScrollActu() { var x = 1; var stayScroll = new YAHOO.util.Scroll('bandeauActu', {scroll: { by: [0, 0] }},2); var animScroll = new YAHOO.util.Scroll('bandeauActu', {scroll: { by: [0, 60] }},2); var initScroll = new YAHOO.util.Scroll('bandeauActu', {scroll: { to: [0, 0] }},0); YAHOO.util.Event.on(window, 'load', function() { //stayScroll.animate(); initScroll.animate(); }); stayScroll.onComplete.subscribe(function() { if(x>=3){ x=1; initScroll.animate(); }else{ x+=1; animScroll.animate(); } }); animScroll.onComplete.subscribe(function() { stayScroll.animate(); }); initScroll.onComplete.subscribe(function() { animScroll.animate(); }); } function writeScrollPert() { var x = 1; var stayScroll = new YAHOO.util.Scroll('bandeauPert', {scroll: { by: [0, 0] }},2); var animScroll = new YAHOO.util.Scroll('bandeauPert', {scroll: { by: [0, 60] }},2); var initScroll = new YAHOO.util.Scroll('bandeauPert', {scroll: { to: [0, 0] }},0); YAHOO.util.Event.on(window, 'load', function() { //stayScroll.animate(); initScroll.animate(); }); stayScroll.onComplete.subscribe(function() { if(x>=12){ x=1; initScroll.animate(); }else{ x+=1; animScroll.animate(); } }); animScroll.onComplete.subscribe(function() { stayScroll.animate(); }); initScroll.onComplete.subscribe(function() { animScroll.animate(); }); }