Box and Blink


The colors at the top light up but the box and blink functions are not working. Would someone please help!


Please post a link to the exercise. Thanks.



Compare your code to the following spoiler…

  // at top
  var blink;
  // ...

    if (colorClass){
    if ($(this).hasClass('opacity')){
      blink = setInterval(function(){
        $('.box.magenta, .box.yellow, .box.cyan').toggleClass('blink');
      }, 350);
    } else {

Note the use of a variable to reference the setInterval function. We need this if we wish to stop the blinking.

Your code differs from mine only in the above. Note the use of if ($(this).hasClass('opacity')). As I recall this took me quite a while to come up with but my memory is not very good since I did this a couple of years ago. Hopefully it will give some ideas and you might even come back with something better still.