From 1ce4cc968b9b1e6a3acba549e55cb902ac25c904 Mon Sep 17 00:00:00 2001 From: ursula Date: Thu, 15 Sep 2016 21:15:00 +1200 Subject: [PATCH 1/4] adds function 2 --- classes.js | 15 +++++++++------ style.css | 4 ++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/classes.js b/classes.js index 385fef5..9ff2a70 100644 --- a/classes.js +++ b/classes.js @@ -1,12 +1,13 @@ -// Don't change or delete this line! It waits until the DOM has loaded, then calls -// the start function. More info: +// Don't change or delete this line! It waits until the DOM has loaded, then calls +// the start function. More info: // https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded document.addEventListener('DOMContentLoaded', start) function start () { // The first example is done for you. Uncomment the line below and reload the browser. - // one() - + one() + two() + // Your turn! Create a new function called `two`, then call it from here. } @@ -18,8 +19,10 @@ function one () { one.classList.add('blue') } -// CREATE FUNCTION two HERE - +function two () { + var two = document.getElementById('two') + two.classList.add('green') +} // CREATE FUNCTION three HERE // CREATE FUNCTION makeVisible HERE diff --git a/style.css b/style.css index 9590cf2..64a94a0 100644 --- a/style.css +++ b/style.css @@ -21,6 +21,10 @@ div.blue { background-color: blue; } +div.green { + background-color: green; +} + .invisible { display: none; } From afafd5c7efbcc9118f6196a95d4c2fbceca7daa5 Mon Sep 17 00:00:00 2001 From: ursula Date: Thu, 15 Sep 2016 21:17:03 +1200 Subject: [PATCH 2/4] adds function 3 --- classes.js | 8 +++++++- style.css | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/classes.js b/classes.js index 9ff2a70..219711b 100644 --- a/classes.js +++ b/classes.js @@ -7,6 +7,7 @@ function start () { // The first example is done for you. Uncomment the line below and reload the browser. one() two() + three() // Your turn! Create a new function called `two`, then call it from here. } @@ -23,6 +24,11 @@ function two () { var two = document.getElementById('two') two.classList.add('green') } -// CREATE FUNCTION three HERE + +function three() { + var three = document.getElementById('three') + three.classList.add('pink') +} + // CREATE FUNCTION makeVisible HERE diff --git a/style.css b/style.css index 64a94a0..be34357 100644 --- a/style.css +++ b/style.css @@ -25,6 +25,10 @@ div.green { background-color: green; } +div.pink { + background-color: pink; +} + .invisible { display: none; } From 44d0cb404f3a23ed2e6b19a435ac310386caf61e Mon Sep 17 00:00:00 2001 From: ursula Date: Thu, 15 Sep 2016 23:11:05 +1200 Subject: [PATCH 3/4] adds function makeVisible --- classes.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes.js b/classes.js index 219711b..8f87c6f 100644 --- a/classes.js +++ b/classes.js @@ -8,6 +8,7 @@ function start () { one() two() three() + makeVisible() // Your turn! Create a new function called `two`, then call it from here. } @@ -30,5 +31,8 @@ function three() { three.classList.add('pink') } - -// CREATE FUNCTION makeVisible HERE +function makeVisible() { + var makeVisible = document.getElementsByClassName('invisible')[0] +makeVisible.classList.remove('invisible')[0] +makeVisible.classList.add('visible')[0] +} From 3a7272ad5ee146d5118400da902f17bcc1afa772 Mon Sep 17 00:00:00 2001 From: ursula Date: Thu, 15 Sep 2016 23:13:30 +1200 Subject: [PATCH 4/4] removes arrays from function, fixes fourth div --- classes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes.js b/classes.js index 8f87c6f..7cae600 100644 --- a/classes.js +++ b/classes.js @@ -33,6 +33,6 @@ function three() { function makeVisible() { var makeVisible = document.getElementsByClassName('invisible')[0] -makeVisible.classList.remove('invisible')[0] -makeVisible.classList.add('visible')[0] +makeVisible.classList.remove('invisible') +makeVisible.classList.add('visible') }