I can maybe add yet another counter that quits the function after one loop, but that seems like a cheat and I'd rather do it correctly.
It works perfectly otherwise (it is supposed to glide some elements of the web page to the left). Like I said I can post everything if necessary.
- Code: Select all
function flyIn(evnt){
//shifts y-axis far to the left
var y = -100;
//choses the label div or class
if (document.querySelectorAll)
{
labels = document.querySelectorAll('div.label');
}
else if (document.getElementsByClassName)
{
labels = document.getElementsByClassName('label');
}
//loops through the labels
if (labels){
for (var i=1; i <= labels.length; i++)
{var labelName = "label" + i;
//picks the labels by each Id
var objFly = document.getElementById(labelName);
//starts a counter
for (var MoveI=0; MoveI < 200; MoveI++)
{
//sets the position, one pixel at a time
y = y + 1;
number_y = y;
document.getElementById(labelName).style.left = number_y + "px";
if (number_y < 100) {
window.setTimeout("flyIn()", 1000);
} alert("got this far");
}
y=-100;
}
}
}


