var marqueeText = new Array(); marqueeText[0] = "This is v2 of the Vertical Scrolling Marquee."; marqueeText[1] = "It functions very much like the first marquee, just with no iframe..."; marqueeText[2] = "...and each marqueeText index has its own DIV element."; marqueeText[3] = "This allows for the new fade feature that you see."; marqueeText[4] = "It also pauses if you mouseover it." marqueeText[5] = "That's all there is too it. Here comes the first line again."; var currentScroller = 0; var secondScroller = 1; var currentOpacity = new Array(); var currentTop = new Array(); var mInterval; var pause = false; var MOVE_STEP = 1; var FADE_STEP = 5; var FADE_IN = 90; var FADE_OUT = 30; var ABS_TOP = 0; var START_SECOND = FADE_OUT; var SPEED = 50; function init() { mHTML = ""; y = 100; for(i=0;i<marqueeText.length;i++) { mHTML+="<div name=\"marq\" id=\"marq\" class=\"marquee\" style=\"top:100px;\">" + marqueeText[i] + "</div>"; currentOpacity[i]=0; currentTop[i]=100; y+=50; } document.getElementById("mContainer").innerHTML = mHTML; mInterval = setInterval("doScroll()",SPEED); } function doScroll() { if(pause)return; currentTop[currentScroller]-=MOVE_STEP; document.getElementsByName("marq")[currentScroller].style.top = currentTop[currentScroller]; if(currentTop[currentScroller] < FADE_IN && currentTop[currentScroller] > FADE_OUT) { if(currentOpacity[currentScroller]<100)currentOpacity[currentScroller]+=FADE_STEP; setOpacity(currentScroller); } else if(currentTop[currentScroller]< FADE_OUT) { if(currentOpacity[currentScroller]>0)currentOpacity[currentScroller]-=FADE_STEP; setOpacity(currentScroller); if(currentTop[currentScroller]<=START_SECOND) { secondScroller = currentScroller + 1; if(secondScroller == marqueeText.length) { secondScroller = 0; currentTop[0]=100; currentOpacity[0]=0; } currentTop[secondScroller]-=MOVE_STEP; document.getElementsByName("marq")[secondScroller].style.top = currentTop[secondScroller]; if(currentOpacity[secondScroller]<100)currentOpacity[secondScroller]+= FADE_STEP; setOpacity(secondScroller); } } if(currentTop[currentScroller] == ABS_TOP) { currentScroller++; secondScroller = currentScroller -1; if(currentScroller == marqueeText.length) { currentScroller = 0; for(i=0;i<marqueeText.length;i++) { currentTop[i] = 100; currentOpacity[i] = 0; } } } } function setOpacity(objIndex) { if(document.all) { document.getElementsByName("marq")[objIndex].style.filter = "alpha(opacity="+currentOpacity[objIndex]+")" } else { document.getElementsByName("marq")[objIndex].style.MozOpacity = currentOpacity[objIndex]/100; } }
Vertical Scrolling Marquee II v1.0 Last revision: 08.13.2003 steve@slayeroffice.com http://www.slayeroffice.com |