From 663016dec942e21cb5250f2e031c3155ca386067 Mon Sep 17 00:00:00 2001 From: Ivanelle Hunt Date: Fri, 7 Jul 2023 19:27:02 -0700 Subject: [PATCH 1/3] finished --- src/index.js | 64 +++++++++++++++++++++++++++++++++++++++++++- src/less/global.less | 5 ++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 13e4739cd..30697730e 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,65 @@ import './less/index.less' -// Your code goes here! +//click +document.body.addEventListener('click', evt => { + evt.target.classList.toggle('mirror') +}) + +//KEYDOWN +window.addEventListener('keydown', evt => { + if (evt.key == 6) { + document.body.innerHTML = '

NEVER CLICK 6 AGAIN

' + } +}) +// MOUSEOVER +const logoHeading = document.querySelector('.logo-heading') + +logoHeading.addEventListener('mouseover', evt => { + evt.target.style.color = '#FFA500' + logoHeading.textContent = 'ROLL OUT!' +}) + +//MOUSE LEAVE & MOUSE ENTER +const destinations = document.querySelectorAll('.destination') +for(let destination of destinations) { + destination.addEventListener('mouseenter', evt => { + destination.style.fontWeight = 'bold' + }) + destination.addEventListener('mouseleave', evt => { + destination.style.fontWeight = 'initial' + }) +} + + +//DoubleClick +document.body.addEventListener('dblclick', evt => { + evt.target.outerHTML = '' +}) + +//MOUSEMOVE +document.body.addEventListener('mousemove', evt => { + const {clientX, clientY} = evt + // console.log(`mousey boy is at ${clientX}, ${clientY}`) +}) + +//COPY +const welcome = document.querySelector('h2') + +window.addEventListener('copy', () => { + navigator.clipboard.readText() + .then(text => { + welcome.textContent += text + }) +}) + +//FOCUS + +window.addEventListener('resize', () => { + alert('Window Resized!') +}) + + //onload + window.onload = function (evt) { + const footer = document.querySelector('.footer') + footer.textContent = 'ALL ABOARD!' + } \ No newline at end of file diff --git a/src/less/global.less b/src/less/global.less index 56883b027..7d90eeff9 100644 --- a/src/less/global.less +++ b/src/less/global.less @@ -2,6 +2,11 @@ box-sizing: border-box; } +&.mirror { + transform: rotateY(180deg); + transition: transform 0.5s ease-in-out; +} + html { font-size: 62.5%; } From 024ad01ead03b51bff6dd222bf02feee7ab26a05 Mon Sep 17 00:00:00 2001 From: Ivanelle Hunt Date: Sun, 9 Jul 2023 12:37:03 -0700 Subject: [PATCH 2/3] finished for real --- src/index.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/index.js b/src/index.js index 30697730e..2ad10ee56 100644 --- a/src/index.js +++ b/src/index.js @@ -1,17 +1,17 @@ import './less/index.less' -//click -document.body.addEventListener('click', evt => { +//CLICK - 1 +document.querySelector('nav :nth-child(1)').addEventListener('click', evt => { evt.target.classList.toggle('mirror') }) -//KEYDOWN +//KEYDOWN - 2 window.addEventListener('keydown', evt => { if (evt.key == 6) { document.body.innerHTML = '

NEVER CLICK 6 AGAIN

' } }) -// MOUSEOVER +// MOUSEOVER - 3 const logoHeading = document.querySelector('.logo-heading') logoHeading.addEventListener('mouseover', evt => { @@ -19,7 +19,7 @@ logoHeading.addEventListener('mouseover', evt => { logoHeading.textContent = 'ROLL OUT!' }) -//MOUSE LEAVE & MOUSE ENTER +//MOUSE LEAVE & MOUSE ENTER - 4 & 5 const destinations = document.querySelectorAll('.destination') for(let destination of destinations) { destination.addEventListener('mouseenter', evt => { @@ -31,18 +31,18 @@ for(let destination of destinations) { } -//DoubleClick +//DoubleClick - 6 document.body.addEventListener('dblclick', evt => { evt.target.outerHTML = '' }) -//MOUSEMOVE +//MOUSEMOVE - 7 document.body.addEventListener('mousemove', evt => { const {clientX, clientY} = evt // console.log(`mousey boy is at ${clientX}, ${clientY}`) }) -//COPY +//COPY - 8 const welcome = document.querySelector('h2') window.addEventListener('copy', () => { @@ -52,14 +52,21 @@ window.addEventListener('copy', () => { }) }) -//FOCUS +//RESIZE - 9 window.addEventListener('resize', () => { alert('Window Resized!') }) - //onload - window.onload = function (evt) { + //ONLOAD - 10 + window.onload = function () { const footer = document.querySelector('.footer') footer.textContent = 'ALL ABOARD!' - } \ No newline at end of file + + } + + //PREVENTDEFAULT() +document.querySelector('nav :nth-child(2)').addEventListener('click', function(e){ + alert('This took forever to do') + e.preventDefault(); +}) From c8f66cf91f5f9249c732a4d895df928ac34d6119 Mon Sep 17 00:00:00 2001 From: Ivanelle Hunt Date: Mon, 10 Jul 2023 10:42:09 -0700 Subject: [PATCH 3/3] Finished --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index 2ad10ee56..baf00c93e 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,6 @@ import './less/index.less' +document.addEventListener("DOMContentLoaded", function () { //CLICK - 1 document.querySelector('nav :nth-child(1)').addEventListener('click', evt => { evt.target.classList.toggle('mirror') @@ -70,3 +71,5 @@ document.querySelector('nav :nth-child(2)').addEventListener('click', function(e alert('This took forever to do') e.preventDefault(); }) + +}) \ No newline at end of file