diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index.html similarity index 98% rename from 01 - JavaScript Drum Kit/index-START.html rename to 01 - JavaScript Drum Kit/index.html index 4070d32767..447405849d 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index.html @@ -57,7 +57,9 @@ - diff --git a/01 - JavaScript Drum Kit/script.js b/01 - JavaScript Drum Kit/script.js new file mode 100644 index 0000000000..46530729a1 --- /dev/null +++ b/01 - JavaScript Drum Kit/script.js @@ -0,0 +1,23 @@ +const keys = Array.from(document.querySelectorAll(".key")); + +const keysList = keys.map(keyEl => keyEl.dataset.key).map(str => Number(str)); + +console.log(keys); + +document.addEventListener("keyup", event => { + if (keysList.includes(event.keyCode)) { + console.log("play sound"); + + const audio = document.querySelector(`audio[data-key="${event.keyCode}"]`); + const key = document.querySelector(`.key[data-key="${event.keyCode}"]`); + + key.classList.add("playing"); + audio.play(); + } +}); + +keys.forEach(key => + key.addEventListener("transitionend", e => { + e.target.classList.remove("playing"); + }) +); diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html deleted file mode 100644 index 7cbf5f6ba6..0000000000 --- a/02 - JS and CSS Clock/index-START.html +++ /dev/null @@ -1,74 +0,0 @@ - - -
- -Psst: have a look at the JavaScript Console π
- - - diff --git a/04 - Array Cardio Day 1/index.html b/04 - Array Cardio Day 1/index.html new file mode 100644 index 0000000000..c4f08bc328 --- /dev/null +++ b/04 - Array Cardio Day 1/index.html @@ -0,0 +1,141 @@ + + + + +Psst: have a look at the JavaScript Console π
+ + + diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html deleted file mode 100644 index 71d1c26f00..0000000000 --- a/05 - Flex Panel Gallery/index-START.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - -Hey
-Let's
-Dance
-Give
-Take
-Receive
-Experience
-It
-Today
-Give
-All
-You can
-Life
-In
-Motion
-Hey
+Let's
+Dance
+Give
+Take
+Receive
+Experience
+It
+Today
+Give
+All
+You can
+Life
+In
+Motion
+Psst: have a look at the JavaScript Console π
- - + + +Psst: have a look at the JavaScript Console π
+ + diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 9da9b5b3c5..73bd6ae6c7 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -1,19 +1,67 @@ - - -ΓBREAKΓDOWNΓ
- - - + + +ΓBREAKΓDOWNΓ
+ + + diff --git a/10 - Hold Shift and Check Checkboxes/index-START.html b/10 - Hold Shift and Check Checkboxes/index-START.html index 4fd2936ddc..1e1fc0d8e4 100644 --- a/10 - Hold Shift and Check Checkboxes/index-START.html +++ b/10 - Hold Shift and Check Checkboxes/index-START.html @@ -1,101 +1,127 @@ - - -This is an inbox layout.
-Check one item
-Hold down your Shift key
-Check a lower item
-Everything in between should also be set to checked
-Try to do it without any libraries
-Just regular JavaScript
-Good Luck!
+This is an inbox layout.
+Check one item
+Hold down your Shift key
+Check a lower item
+Everything in between should also be set to checked
+Try to do it without any libraries
+Just regular JavaScript
+Good Luck!
+Don't forget to tweet your result!
+Don't forget to tweet your result!
-