N
Nalum
Hey all,
I'm trying to scroll the content of a div tag up and down.
I've gotten that to work but, I need it to keep scrolling while the
mouse is over the image.
This is the code that I have at the moment.
function scrollUp(div)
{
// we first have to get the position of the div.
var topOfDiv = div.scrollTop;
var heightOfDiv = div.scrollHeight;
// now we have to check that the div when scrolling up doesn't scroll
past the top.
if(topOfDiv > 0)
{
div.scrollTop = div.scrollTop - (div.scrollAmount = 8);
setTimeout(scrollUp(div), 1); <-- this is where I'm having trouble.
}
}
I can't get the setTimeout to work with the scrollUp argument.
I'm trying to get it to scroll up the content of the div slowly so
that it is a visible process and doesn't just jump from end to end.
which it does at the moment.
I'm trying to scroll the content of a div tag up and down.
I've gotten that to work but, I need it to keep scrolling while the
mouse is over the image.
This is the code that I have at the moment.
function scrollUp(div)
{
// we first have to get the position of the div.
var topOfDiv = div.scrollTop;
var heightOfDiv = div.scrollHeight;
// now we have to check that the div when scrolling up doesn't scroll
past the top.
if(topOfDiv > 0)
{
div.scrollTop = div.scrollTop - (div.scrollAmount = 8);
setTimeout(scrollUp(div), 1); <-- this is where I'm having trouble.
}
}
I can't get the setTimeout to work with the scrollUp argument.
I'm trying to get it to scroll up the content of the div slowly so
that it is a visible process and doesn't just jump from end to end.
which it does at the moment.