class not looping

I have these if statements inside my draw() loop. I have a variable name container which is looking for a div nameContainer. It does attach a class based on the time. That does work the first round but after full loop the classes don't seem to change anymore and the text stays white. Am I missing something?

    var namecontainer = getElement('nameContainer');

    if (second() < 14) {
        namecontainer.class('ochtendInverse'); //blue
    }
    if (second() >= 14 && second() < 30) {
        namecontainer.class('middagInverse'); //black
    }
   if (second() > 30 && second() <= 40) {
        namecontainer.class('avondnachtInverse'); // white
    }
    if (second() > 40 && second() <= 59) {
        namecontainer.class('avondnachtInverse'); //white
    }
Tagged:

Answers

  • edited February 2015

    The conditions do not handle 30

    Also I am assuming that second() cannot have a larger value than 59, but you could just drop:

    second() <= 59

  • usinf if .... else if.... it all could be shorter

    code looks correct though

    Thus I assume you error lies elsewhere in the code

    misdefined colors, not using namecontainer.class etc. ..... ?

Sign In or Register to comment.