From c345a7a772ce6a7581f0c8f871c99e3c48f87e63 Mon Sep 17 00:00:00 2001 From: mbhat25 Date: Tue, 7 Jun 2016 18:40:47 -0400 Subject: [PATCH] HW Upload #1 --- css/style.css | 12 ++++++++++++ index.html | 3 +++ js/index.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 js/index.js diff --git a/css/style.css b/css/style.css index 2d8d793..12a227c 100644 --- a/css/style.css +++ b/css/style.css @@ -39,3 +39,15 @@ h1 { margin: 25px auto; transition: background 500ms; } + +#red { + background-color: red; +} + +#yellow { + background-color: yellow; +} + +#green { + background-color: green; +} diff --git a/index.html b/index.html index 0180c07..2df9484 100644 --- a/index.html +++ b/index.html @@ -23,5 +23,8 @@

Go

+ + + diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..fbc553e --- /dev/null +++ b/js/index.js @@ -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'); + } + + +});