Jump to content

Vertical Div Scroller


Howdy_McGee

Recommended Posts

Ok, so i'm hoping you guys can help me with this one, the scenario is: I have a up arrow and down arrow and a middle div holding all kinds of elements in it. I need to make a script where IF the user clicks on the up arrow it moves up 4 elements, or moves up a div. Vice Versa when the user clicks on the down arrow.I started working on a script that looks like this but I don't know where to go from there.

var divScroll = [];	divScroll[0] = document.getElementById('i1t5');	divScroll[1] = document.getElementById('16t10');	divScroll[2] = document.getElementById('i11t15');	function click(){	if (document.getElementById('arrowUp'))	{		for (int i = 0; i < divScroll.length; i--)		{			document.getElementById('leftScroll');					}	}	if (document.getElementById('arrowDown'))	{		for (int i = 0; i < divScroll.size(); i++)		{					}	}}

each div has a separate ID containing 4 elements, but then I think i want a visual effect so I found this script.

scrollStep=1 timerUp=""timerDown="" function toTop(id){document.getElementById(id).scrollTop=0} function scrollDivDown(id){clearTimeout(timerDown) document.getElementById(id).scrollTop+=scrollSteptimerDown=setTimeout("scrollDivDown('"+id+"')",10)} function scrollDivUp(id){clearTimeout(timerUp)document.getElementById(id).scrollTop-=scrollSteptimerUp=setTimeout("scrollDivUp('"+id+"')",10)} function toBottom(id){document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight} function stopMe(){clearTimeout(timerDown) clearTimeout(timerUp)}

The problem with the script above is its an "on hover" I need to somehow combine the 2 scripts so it acts like I'm hoving over it for a certain amount of miliseconds and stops, that will both give me the effect I want and functionality I want. Anyone know where I should begin with this?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...