diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..2f807eadb5 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,6 +59,26 @@ diff --git a/01 - JavaScript Drum Kit/style.css b/01 - JavaScript Drum Kit/style.css index 3e0a320b37..175e648535 100644 --- a/01 - JavaScript Drum Kit/style.css +++ b/01 - JavaScript Drum Kit/style.css @@ -1,6 +1,6 @@ html { font-size: 10px; - background:url(http://i.imgur.com/b9r5sEL.jpg) bottom center; + background:url(https://chorus.fm/wp-content/uploads/2016/04/fleetfoxes.jpg) bottom center; background-size: cover; } body,html { diff --git a/02 - JS + CSS Clock/Memo.txt b/02 - JS + CSS Clock/Memo.txt new file mode 100644 index 0000000000..67c2d7cc85 --- /dev/null +++ b/02 - JS + CSS Clock/Memo.txt @@ -0,0 +1,12 @@ +1. CSS clock hand: + - use transform: rotate() in CSS file + - by default the object rotates in the middle of the object: use transform-origin: x%; to move the origin on the X axis. + - set default rotate at 90° to have them face upwards + - set a transition for the animation not to be too hard: transition: all 0.5s; + - use a transition-timing-funtion to update the way the object moves + +2. JS: + - setInterval to set the interval at which the hands should move + - A function to set the date. You have a date you find which second you are currently in then you transform into degress (make sure that you add 90° to the total because we added that to the CSS) + - then you add the style transform rotate by variable degrees. + diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..0b0a5455a3 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,13 +61,42 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all 0.1s; + transition-timing-function: cubic-bezier(0.54, 2.52, 0.96, 1.09); } diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..6b9326d615 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -22,9 +22,21 @@

Update CSS Variables with JS

+ diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 4162bce339..852e0d6afc 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,28 +33,59 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + let fiteen = inventors.filter(inventor => inventor.year >= 1500 && inventor.year < 1600); + console.table(fiteen); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + let fullNames = inventors.map(inventor => inventor.first + " " + inventor.last); + console.log(fullNames); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + let ordered = inventors.sort((a, b) => a.year > b.year ? 1 : -1); + console.table(ordered); // Array.prototype.reduce() // 4. How many years did all the inventors live? + const yearsLived = inventors.reduce((total, inventor) => { + return total + (inventor.passed - inventor.year); + }, 0); + console.log(yearsLived); // 5. Sort the inventors by years lived + const orderLife = inventors.sort((a, b) => { + const aLife = a.passed - a.year; + const bLife = b.passed - b.year; + (aLife > bLife) ? -1 : 1; + }); + console.table(orderLife); // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris - + // const boulevards = [... document.querySelectorAll('.mw-category a')] + // let result = boulevards.map(boulevard => boulevard.textContent).filter(boulevard => boulevard.includes(`Boulevard de`)) // 7. sort Exercise // Sort the people alphabetically by last name + let sorted = people.sort((lastOne, nextOne) => { + const [aLast, aFirst] = lastOne.split(`, `); + const [bLast, bFirst] = nextOne.split(`, `); + return aLast < bLast ? -1 : 1 ; + }); + console.log(sorted); // 8. Reduce Exercise // Sum up the instances of each of these const data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck' ]; + const count = data.reduce((obj, item) => { + if (!obj[item]) { + obj[item] = 0; + } + obj[item]++; + return obj; + }, {}); + console.log(count); diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..dac9f1bcbb 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -24,6 +24,7 @@ .panels { min-height:100vh; overflow: hidden; + display: flex; } .panel { @@ -41,6 +42,11 @@ font-size: 20px; background-size:cover; background-position:center; + flex: 1; + display: flex; + text-align: center; + justify-content: center; + flex-direction: column; } @@ -54,6 +60,10 @@ margin:0; width: 100%; transition:transform 0.5s; + flex: 1 0 auto; + display: flex; + justify-content: center; + align-items: center; } .panel p { @@ -66,7 +76,23 @@ font-size: 4em; } + .panel > *:first-child { + transform: translateY(-100%); + } + + .panel.open-active > *:first-child { + transform: translateY(0); + } + + .panel > *:last-child { + transform: translateY(100%); + } + + .panel.open-active > *:last-child { + transform: translateY(0); + } .panel.open { + flex: 5; font-size:40px; } @@ -107,7 +133,17 @@ diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..a454e9a3e9 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -15,7 +15,52 @@ diff --git a/06 - Type Ahead/style.css b/06 - Type Ahead/style.css index 36dc55f30e..42badccd7a 100644 --- a/06 - Type Ahead/style.css +++ b/06 - Type Ahead/style.css @@ -38,8 +38,8 @@ margin: 0; padding: 0; position: relative; - /*perspective:20px;*/ - } +/* perspective:20px; +*/ } .suggestions li { background:white; list-style: none; diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 206ec31aa0..9956c61617 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,15 +26,36 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19? + const isAdult = people.some(person => { + let date = (new Date()).getFullYear(); + let age = date - person.year; + return age >= 19; + }); + console.log(isAdult); // Array.prototype.every() // is everyone 19? + const allAdults = people.every(person => { + let date = (new Date()).getFullYear(); + let age = date - person.year; + return age >= 19; + }); + console.log(allAdults); + // Array.prototype.find() // Find is like filter, but instead returns just the one you are looking for // find the comment with the ID of 823423 + const idcheck = comments.find(comment => (comment.id === 823423)); + console.log(idcheck); // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + const findDelete = comments.findIndex(comment => (comment.id === 823423)); + console.table(comments); + comments.splice(findDelete, 1); + console.table(comments); + + diff --git a/10 - Hold Shift and Check Checkboxes/index-START.html b/10 - Hold Shift and Check Checkboxes/index-START.html index eb7ed310bb..4c5fdcacea 100644 --- a/10 - Hold Shift and Check Checkboxes/index-START.html +++ b/10 - Hold Shift and Check Checkboxes/index-START.html @@ -104,6 +104,41 @@