Need to create a sequence of functions stored in an array. Need them to be executed every 400ms. Did it by setting 500 setTimeout(function(){})'s. Somehow learned that should do it by creating it dynamically. Have the functions ready, but missing the timeouts to make it a nice animation
Here is the part where I think I have to set the timeout's in:
function start() {
mylist.name = this.className;
mylist.identifier = 'port'+parseFloat(this.id);
mylist.number = parseFloat(this.id);
console.log(mylist.number);
for (var x in todo) {
todo[x]();
}
}
And here is the array with the functions. Thank you
ps: sorry for bad english, made in Germany :)
todo = [
function computer1() {
$('.'+mylist.name+':eq(1)').css({'background-color': 'chartreuse'});
},
function kabel1() {
$('.'+mylist.name+':eq(0)').css({'border-bottom-color': 'chartreuse'});
},
function port1() {
$('#'+mylist.identifier).css({'background-color': 'chartreuse'});
},
function port2() {
for (var x=0;x<ports;x++) {
$('#port'+(x+1)).css({'background-color': 'blue'});
if (x===(mylist.number-1)) {
$('#port'+(x+1)).css({'background-color': 'chartreuse'});
}
}
},
function kabel2() {
for (var x=0;x<ports;x++) {
$('#portugal'+(x+1)+':eq(0)').css({'border-bottom-color': 'blue'});
if (x===(mylist.number-1)) {
$('#portugal'+(x+1)+':eq(0)').css({'border-bottom-color': 'chartreuse'});
}
}
},
function device2() {
for (var x=0;x<ports;x++) {
$('#'+(x+1)+'device').css({'background-color': 'blue'});
if (x===(mylist.number-1)) {
$('#'+(x+1)+'device').css({'background-color': 'chartreuse'});
}
}
},
function device3() {
for (var x=0;x<ports;x++) {
if (document.getElementById('info').textContent==document.getElementById((x+1)+'device').className) {
var hammer = document.getElementById((x+1)+'device').getAttribute('class');
$('.'+hammer+':eq(1)').css({'background-color': 'red'});
}
}
},
function mehr() {
}]