Hello, i need a help i tried lite brite ,the project is running but it show me that only 3 tasks completed,I need your help please


#1

var main = function(){
var colorClass = ‘’;
var blink;
var toggleBlink = function(){
if (!blink){
blink = setInterval(function(){
$(’.box.magenta’).toggleClass(‘blink’);
$(’.box.yellow’).toggleClass(‘blink’);
$(’.box.cyan’).toggleClass(‘blink’);
}, 350);
} else {
window.clearInterval(blink);
blink = null;
}
};
$(’.select-color’).on(‘click’, function(){
var selectedColor = $(this).attr(‘class’);
var cyan = ‘select-color cyan not-selected’;
var yellow = ‘select-color yellow not-selected’;
var magenta = ‘select-color magenta not-selected’;
if (selectedColor === cyan){
colorClass = ‘cyan’;
} else if (selectedColor === yellow) {
colorClass = ‘yellow’;
} else if (selectedColor === magenta){
colorClass = ‘magenta’;
}
$(this).toggleClass(‘not-selected’);
$(this).siblings().addClass(‘not-selected’);
});
$(’.box’).on(‘click’, function(){
$(this).toggleClass(colorClass);
console.log(colorClass);
});
$(’.toggle-blink’).on(‘click’, function(){
if (colorClass){
$(’.toggle-blink’).toggleClass(‘opacity’);
toggleBlink();
}
});
}

$(document).ready(main);


#2

Did you have this code running locally? It won’t run for me.


#3

You need to manually click the task to mark it as completed when completing projects. If everything is running as it should be you are free to check the boxes yourself.


#4

Did you test this code? What does it matter if we self check our way through a project that doesn’t work? What is the point of doing the project in the first place? For badges? Or to learn something? Determination is what is needed here, not check marks.


#5

I am trying this for my determination ,not check marks


#6

My understanding based on the question was that his code was working and the project was running but that only 3 tasks were completed meaning he hadn’t checked off the tasks to continue on with the lesson. I did not mean to imply that we should only “do it for the badges”.


#7

I haven’t been able to get the code to run on my machine. We have not seen the HTML or CSS for this project, so I merged the code with my own. My script runs as expected but the one above does nothing. It won’t select a color, and it won’t color the dots. Blink will not work if we don’t have a color set.

Determination sometimes involves shelving everything and starting again from scratch. Get one component to work before writing the second. That is, get the color selector to work so that it shows in the header when a color is clicked. Once that works, get the dots to light up with the selected color. They should turn off when clicked a second time with the same color. Only when both those features are working should the blink feature be added into the program.


#8

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