PDA

View Full Version : Scrollable Content II default content position?



bholland
08-04-2006, 06:05 AM
1) Script Title: Scrollable Content II

2) Script URL (on DD): http://dynamicdrive.com/dynamicindex11/scrollc2.htm

3) Describe problem: I'm wondering if there is a way to automatically start the content div at the bottom. I'm going to be using this for a growing list of items and each new item that is added will be at the bottom of the list. I want to display the most recently added item by default (the bottom of the list). Is there a way to set this to default to the bottom? I suppose it could be a page onLoad thing because there won't be any dynamic content going in without a browser reload.

Thanks!

B

jscheuer1
08-04-2006, 07:15 AM
Here is the function that is already used to slowly move to the bottom:


function movedown(){
if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
crossobj.style.top=parseInt(crossobj.style.top)-speed+"px"
else if (ns4&&crossobj.top>=(contentheight*(-1)+100))
crossobj.top-=speed
movedownvar=setTimeout("movedown()",20)
}

You could make up a similar function:


function movedownfast(){
if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100)){
crossobj.style.top=parseInt(crossobj.style.top)-speed+"px";
movedownfast();
}
else if (ns4&&crossobj.top>=(contentheight*(-1)+100)){
crossobj.top-=speed;
movedownfast();
}
}

If you want this new function to run as soon as it can, find this function and add the red part:


function getcontent_height(){
if (iens6)
contentheight=crossobj.offsetHeight
else if (ns4)
document.nscontainer.document.nscontent.visibility="show"
movedownfast();
}

bholland
08-04-2006, 04:30 PM
Thanks! I'll give this a try :)

B