PDA

View Full Version : adding loop pause / delay to Cross Browser marquee II



mannkumar
07-19-2010, 04:56 PM
1) Script Title:
Cross Browser marquee II

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex2/cmarquee2.htm
http://www.dynamicdrive.com/forums/showthread.php?t=55949

3) Describe problem:
Having received fantastic help from vwphillps to get the Cross Browser marquee II working with with multiple scrolls/feeds (and without the extra space) i've been struggling to add a delay / pause between each loop. i.e if you look at my page below there are various different delays on page load.

http://lotus-architects.com/contact.html

however i would like each feed to stop at the beginning (at the title), or a few seconds before continuing the loop

does anyone know if its possible (note i used the script provided by vwphillipss on post #4 of the above thread rather than the original)

vwphillips
07-20-2010, 09:13 AM
<script type="text/javascript">
/*<![CDATA[*/
function Marquee(o){
var oop=this,obj=document.getElementById(o.ID),top=0;
var marquee=obj.getElementsByTagName('DIV')[0];
this.marqueeheight=marquee.offsetHeight;
marquee.style.top=-this.marqueeheight+'px';

this.marquee=[marquee];
while (top<obj.offsetHeight){
marquee=marquee.cloneNode(true);
marquee.style.top=top+'px';
obj.appendChild(marquee);
this.marquee.push(marquee);
top+=this.marqueeheight;
}

this.Speed=o.marqueespeed;
this.hold=o.hold||30;
var oop=this;
setTimeout(function(){ oop.scroll(true); }, o.delayb4scroll)
}

Marquee.prototype.scroll=function(srt){
var oop=this,ms=30;
for (var top,z0=0;z0<this.marquee.length;z0++){
top=parseInt(this.marquee[z0].style.top)-this.Speed;
this.marquee[z0].style.top=top+"px";
if (top<-this.marqueeheight){
this.marquee[z0].style.top=top+this.marqueeheight*this.marquee.length+"px";
if (!srt){
ms=this.hold;
}
}
}
setTimeout(function(){ oop.scroll(); },ms);
}

/*]]>*/
</script>
<script type="text/javascript">
/*<![CDATA[*/
var M1=new Marquee({
ID:'marqueecont',
delayb4scroll:9900, //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
hold:2000,
marqueespeed:1 //Specify marquee scroll speed (larger is faster 1-10)
});

var M2=new Marquee({
ID:'marqueecont2',
delayb4scroll:3900, //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
hold:2000,
marqueespeed:1 //Specify marquee scroll speed (larger is faster 1-10)
});

var M3=new Marquee({
ID:'marqueecont3',
delayb4scroll:1900, //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
hold:2000,
marqueespeed:1 //Specify marquee scroll speed (larger is faster 1-10)
});

var M4=new Marquee({
ID:'marqueecont4',
delayb4scroll:5900, //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
hold:2000,
marqueespeed:1 //Specify marquee scroll speed (larger is faster 1-10)
});

var M5=new Marquee({
ID:'marqueecont5',
delayb4scroll:7900, //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
hold:2000,
marqueespeed:1 //Specify marquee scroll speed (larger is faster 1-10)
});

var M6=new Marquee({
ID:'marqueecont6',
delayb4scroll:2900, //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
hold:2000,
marqueespeed:1 //Specify marquee scroll speed (larger is faster 1-10)
});

var M7=new Marquee({
ID:'marqueecont7',
delayb4scroll:4900, //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
hold:2000,
marqueespeed:1 //Specify marquee scroll speed (larger is faster 1-10)
});

var M8=new Marquee({
ID:'marqueecont8',
delayb4scroll:6900, //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
hold:2000,
marqueespeed:1 //Specify marquee scroll speed (larger is faster 1-10)
});

var M9=new Marquee({
ID:'marqueecont9',
delayb4scroll:8900, //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
hold:2000,
marqueespeed:1 //Specify marquee scroll speed (larger is faster 1-10)
});






/*]]>*/
</script>