-
Notifications
You must be signed in to change notification settings - Fork 0
/
pets.js
44 lines (35 loc) · 919 Bytes
/
pets.js
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
const animal1 = document.getElementById("animal1");
const images1 = [
"images/jacques1.jpg",
"images/jacques2.jpg"
];
animal1.addEventListener('mouseover', () => {
animal1.src = images1[1];
});
animal1.addEventListener('mouseout', () => {
animal1.src = images1[0];
});
// now do the same for all the other pictures :)
const animal2 = document.getElementById("animal2");
const images2 = [
"images/cody1.jpg",
"images/cody2.jpg"
];
animal2.addEventListener('mouseover', () => {
animal2.src = images2[1];
});
animal2.addEventListener('mouseout', () => {
animal2.src = images2[0];
});
// jello time :)
const animal3 = document.getElementById("animal3");
const images3 = [
"images/jello1.jpg",
"images/jello2.jpg"
];
animal3.addEventListener('mouseover', () => {
animal3.src = images3[1];
});
animal3.addEventListener('mouseout', () => {
animal3.src = images3[0];
})