forked from bloominstituteoftechnology/DOM-II
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
55 lines (46 loc) · 1.65 KB
/
index.js
File metadata and controls
55 lines (46 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Your code goes here
// Make "Fun Bus" text bigger on mouseover
const funBusText = document.querySelector(".logo-heading");
funBusText.addEventListener("mouseover", event => {
funBusText.style.fontSize = "6rem";
});
// Give an alert when the page loads
const hello = document.querySelector("body");
window.addEventListener("load", event => {
alert("Hi, Welcome to Fun Bus!");
});
// Turn background blue on scroll
document.addEventListener("scroll", event => {
document.querySelector("body").style.backgroundColor = "skyblue";
event.stopPropagation();
});
// Don't copy me
document.addEventListener("copy", event => {
alert("Copying is not permitted on this page.");
});
// Turn header pink
const colorHeader = document.querySelector("header");
colorHeader.addEventListener("mouseenter", event => {
colorHeader.style.backgroundColor = "lightcoral";
});
//Turn header back to white
const originalHeader = document.querySelector("header");
originalHeader.addEventListener("mouseleave", event => {
originalHeader.style.backgroundColor = "white";
});
// Change the little bus pic
const changeBus = document.querySelector(".intro img");
changeBus.addEventListener("click", event => {
event.stopPropagation();
changeBus.setAttribute("src", "../img/busPeople.jpg");
});
// Change it back to the little bus
const changeBack = document.querySelector(".intro img");
changeBack.addEventListener("dblclick", event => {
event.stopPropagation();
changeBack.setAttribute("src", "../img/fun-bus.jpg");
});
// Alert when keyboard key is pushed
window.addEventListener("keydown", event => {
alert("You pressed a key on your keyboard. What are you trying to do?");
});