diff --git a/src/index.html b/src/index.html index 3fe4e1214f..8c8aef48c8 100644 --- a/src/index.html +++ b/src/index.html @@ -87,6 +87,7 @@

Island Getaway

diff --git a/src/index.js b/src/index.js index 13e4739cdd..1c34dbcf08 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,72 @@ import './less/index.less' // Your code goes here! +const header = document.querySelector('.main-navigation'); +function headerColor() { + header.style.backgroundColor='green'; + header.style.color='black'; +} +function headerColorRestore() { + header.style.backgroundColor='white'; + header.style.color='black'; +} +header.addEventListener('mouseover', headerColor); // 1 +header.addEventListener('mouseout', headerColorRestore);// 2 +function tellWhatKeyPressed(evt) { + if (evt.key === ' ') { + console.log("You pressed the spacebar!"); + } else { + console.log(`You pressed the ${evt.key} key!`); + } + +} +document.addEventListener('keydown', tellWhatKeyPressed);//3 + +const wholeDoc=document.querySelector('*'); +const button=document.querySelectorAll('.btn'); + +function darkModeOn(evt) { + wholeDoc.style.backgroundColor='black'; + wholeDoc.style.color='white'; + console.log('Activated dark mode!'); +} +function darkModeOff(evt) { + wholeDoc.style.backgroundColor='white'; + wholeDoc.style.color='black'; + console.log('Turned off dark mode!'); +} +const introPic=document.querySelector('.intro') +introPic.addEventListener('dblclick', darkModeOn); //4 +introPic.addEventListener('click', darkModeOff); //5 + +function loader() { + console.log('You made it, cool.'); +} + +window.addEventListener('load', loader) //6 + +const inputFocus=document.querySelector(".user-input"); + +function buttonFocus (evt) { + inputFocus.style.backgroundColor='green'; +} + +inputFocus.addEventListener('focus', buttonFocus);// 7 + +function wheelTest(evt) { + console.log('SPIN THE WHEEEEELLLLLLLL!!!!!'); +} + +document.addEventListener('wheel', wheelTest); // 8 + +function scrollTest(evt) { + console.log('WAHHH YOU LEFT ME BEHIND HOW COULD YOU'); +} + +document.addEventListener('scroll', scrollTest); // 9 + +const navLink=document.querySelector('.nav-link'); +function rickRoll(evt) { + navLink.href="https://www.youtube.com/watch?v=iik25wqIuFo"; +} +navLink.addEventListener('click', rickRoll); //10 \ No newline at end of file