How can help me in lite brite project in javascript,these are not running


#1
function main() {

var colorClass = '';

$('.select-color').on('click', function(){
  var selectedColor = $(this).attr('class');
  switch (selectedColor) {
  case 'select-color cyan not-selected':
    colorClass = 'cyan';
    break;

  case 'select-color yellow not-selected':
    colorClass = 'yellow';
    break;

  case 'select-color magenta not selected':
    colorClass = 'magenta';
    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.magenta').toggleClass('blink');
  }, 350);
}
});
}

$(document).ready(main);

#2

Please post the URL of this exercise. Thanks.


#3

on this link
https://www.codecademy.com/courses/learn-javascript/projects/lite-brite?action=resume_content_item


#4

What is not happening? Blink?


#5

https://www.codecademy.com/courses/learn-javascript/projects/lite-brite?action=resume_content_item


#6

I see that when a dot is clicked, it does not take the color of colorClass. Have you tried limiting the code to just be able to do that?


#7

i have tried all my best,i need your help


#8

I recommend you copy your work and save it locally in a litebrite folder with the same set up.

litebrite/
    css/
        styles.css
    js/
        main.js
    index.html

Work at commenting out everything except the .box listener with an arbitrary colorClass and get the dots to light up on click, and unlight on a second click.


#9

hey sir ,locally it is running but in codeacademy coding room it failed,you can help


#10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.