Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ body {
border-radius: 50%;
margin: 25px auto;
height: 150px;
transition: background 300ms;
/*transition: background 300ms;*/
width: 150px;
}

Expand Down
59 changes: 59 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,63 @@
'use strict';

// YOUR CODE HERE
var stopBtn = document.getElementById('stopButton');
var stopLte = document.getElementById('stopLight');
stopBtn.addEventListener('click', activateStop);
stopBtn.addEventListener('mouseenter', enter);
stopBtn.addEventListener('mouseleave', leave);
function enter(){
console.log("Entered " + this.textContent + " button");
}
function leave(){
console.log("Left " + this.textContent + " button");
}
function activateStop(){
if (stopLte.style.background == "red"){
stopLte.style.background = "black";
} else {stop
stopLte.style.background = "red";
}
}


var slowBtn = document.getElementById('slowButton');
var slowLte = document.getElementById('slowLight');
slowBtn.addEventListener('click', activateSlow);
slowBtn.addEventListener('mouseenter', enter);
slowBtn.addEventListener('mouseleave', leave);
function enter(){
console.log("Entered " + this.textContent + " button");
}
function leave(){
console.log("Left " + this.textContent + " button");
}
function activateSlow(){
if (slowLte.style.background == "orange"){
slowLte.style.background = "black";
} else {
slowLte.style.background = "orange";
}
}


var goBtn = document.getElementById('goButton');
var goLte = document.getElementById('goLight');
goBtn.addEventListener('click', activateGo);
goBtn.addEventListener('mouseenter', enter);
goBtn.addEventListener('mouseleave', leave);

function enter(){
console.log("Entered " + this.textContent + " button");
}
function leave(){
console.log("Left " + this.textContent + " button");
}
function activateGo(){
if (goLte.style.background == "green"){
goLte.style.background = "black";
} else {
goLte.style.background = "green";
}
}
})();