PDA

View Full Version : IFRAME Scroller Help



jamespowell1989
01-22-2009, 11:57 PM
1) Script Title: IFRAME SCROLLER

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/iframe-scroller.htm

3) Describe problem: Hi, I have managed to get the IFRAME Scroller onto a web page I am designing with no problems and it is great!

One question though, when the scroller starts again from the beginning could you tell me how I could get it to delay scrolling once again? As it is at the moment the delay only happens when the page is first loaded.

I hope you can help me! :)

jscheuer1
01-23-2009, 10:50 AM
Change this:


function scrollDiv(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top="5px"
setTimeout("scrollDiv()",40)
}

to:


function scrollDiv(){
dataobj.style.top = parseInt(dataobj.style.top) - scrollspeed + "px";
if (parseInt(dataobj.style.top) < thelength * (-1)) {
dataobj.style.top = "5px";
setTimeout(scrollDiv, initialdelay);
} else
setTimeout(scrollDiv, 40);
};

jamespowell1989
01-23-2009, 02:31 PM
Thanks a lot for your help! That's great! Working perfectly!

Thanks again!

jamespowell1989
01-30-2009, 03:43 PM
Please could you help me change the code so that the ticker scrolls up from the bottom instead of just appearing!?

Thanks for your help guys!

jscheuer1
01-30-2009, 04:14 PM
There are at least two approaches. Have it start out visible, but then when it repeats, have it come in from the bottom. For that use this function in place of the one we already replaced:


function scrollDiv(){
dataobj.style.top = parseInt(dataobj.style.top) - scrollspeed + "px";
if (parseInt(dataobj.style.top) < thelength * (-1))
dataobj.style.top = (window.innerHeight? innerHeight : Math.max(document.documentElement.clientHeight, document.body.clientHeight)) + 5 + "px";
setTimeout(scrollDiv, 40);
};


The other approach would be to have it always start from the bottom, even at the beginning. For that use the scrollDiv() function above, and also change this line:


function initializeScroller(){
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top="5px"
setTimeout("getdataheight()", initialdelay)
}

like so:


function initializeScroller(){
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top = (window.innerHeight? innerHeight : Math.max(document.documentElement.clientHeight, document.body.clientHeight)) + 5 + "px";
setTimeout("getdataheight()", initialdelay)
}