Lite Brite Project - buttons doesnt working


#1

hi, the first button, the select color - is working properly,

the others: 'box' and 'blink' aren't, and i couldn't find the problem. i would like for some help, thanks.

the code:

function main() {
  
        var colorClass = '';

  $('.select-color').on('click', function() {
                        
    var selectedColor = $(this).attr('class');

    switch (selectedColor) {
      case 'selected-color cyan not-selected':
        colorClass = 'cyan';
        break;
      case 'selected-color yellow not-selected':
        colorClass = 'yellow';
        break;
      case 'selected-color magneta not-selected':
        colorClass = 'magneta';
        break;
                         }
    
        $(this).removeClass('not-selected');
    $(this).siblings().addClass('not-selected');
    
                        });
  

  
    $('.box').on('click', function() {
      
      $(this).toggleClass(colorClass);

      
    });
  
  $('.toggle-blink').on('click', function() {
   
    if (colorClass) {
      
      $('.toggle-blink').toggleClass('opacity');
      
      setInterval(function() {
        $('.box.cyan, .box.yellow, .box.magneta').toggleClass('blink');
      }, 350);
    }
    
    
  });
  
  
}


$(document).ready(main);

#2

i got it tnx anyway. the roblem was some misspelling