Gareth Pritchard
asked on
define an integer variable appended with px
basically the script below modifies some CSS to scroll down a div menu, the problem is it doesnt seem to scroll down in pixels ( if i change for example "(<37)" to "(<36)" the layer actually repositions by roughly 10pixels.
var i=-150;
var intHide;
function show()
{
if (i<37)
{
i=i+4;
document.all("foo").style. top=i-1;
}
}
function showmenu()
{
clearInterval(intHide);
intShow=setInterval("show( )",1);
}
function hide()
{
if (i>-150)
{
i=i-4;
document.all("foo").style. top=i;
}
}
function hidemenu()
{
clearInterval(intShow);
intHide=setInterval("hide( )",1);
}
var i=-150;
var intHide;
function show()
{
if (i<37)
{
i=i+4;
document.all("foo").style.
}
}
function showmenu()
{
clearInterval(intHide);
intShow=setInterval("show(
}
function hide()
{
if (i>-150)
{
i=i-4;
document.all("foo").style.
}
}
function hidemenu()
{
clearInterval(intShow);
intHide=setInterval("hide(
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, the guess with nine was wrong. You start from minus 150 and go to 36 or 37. Therefore you have either 46 or 47 steps each 4 pixels.
ASKER
if (i<39)
{
i=i+4;
document.all("foo").style.
}
you have earned the points:
just to clarify, where did you get 9*4=36 based on the script ?
i see the *4 is from i+i=4;
i understand the mathematics behind the problem ( thanks to your explanation ),
i just dont see where the 9* comes into it.