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);
Please post the URL of this exercise. Thanks.
on this link
https://www.codecademy.com/courses/learn-javascript/projects/lite-brite?action=resume_content_item
What is not happening? Blink?
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?
i have tried all my best,i need your help
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.
hey sir ,locally it is running but in codeacademy coding room it failed,you can help
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.