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
12 changes: 12 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,15 @@ h1 {
margin: 25px auto;
transition: background 500ms;
}

#red {
background-color: red;
}

#yellow {
background-color: yellow;
}

#green {
background-color: green;
}
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ <h1 id="goButton" class="button">Go</h1>
<div id="goLight" class="bulb"></div>
</div>

<script src="js/jquery-2.1.4.js"></script>
<script src="js/index.js"></script>

</body>
</html>
28 changes: 28 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
$(document).ready(function(){

$('#stopButton').click(illuminateRed);
$('#slowButton').click(illuminateYellow);
$('#goButton').click(illuminateGreen);


function clearLights() {
$('.bulb').css('background-color', 'black');
}

function illuminateRed() {
clearLights();
$('#stopLight').css('background-color', 'red');
}

function illuminateYellow() {
clearLights();
$('#slowLight').css('background-color', 'yellow');
}

function illuminateGreen() {
clearLights();
$('#goLight').css('background-color', 'green');
}


});