-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathavatarSelector.html
More file actions
101 lines (90 loc) · 2.93 KB
/
avatarSelector.html
File metadata and controls
101 lines (90 loc) · 2.93 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Avatar Selection</title>
<link rel="stylesheet" href="style.css">
<style>
.container{
display: flex;
flex-direction: row;
column-gap: 16px;
}
.content{
display: flex;
flex-direction: column;
row-gap: 16px;
width: 50%;
}
button{
border: 2px solid black;
flex: 1;
}
img{
background-color: white;
border-radius: 500px;
width: 256px;
}
.character-name{
font-weight: bold;
font-size: 20px;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<button id="hat-man">Hat Man</button>
<button id="happy-man">Happy Man</button>
<button id="cool-man">Cool Man</button>
<button id="box-man">Box Man</button>
<button id="cooler-man">Cooler Man</button>
<button id="invisible-man">Invisible Man</button>
</div>
<div>
<p class="character-name">Your Character: Normal Man</p>
<img src="https://api-private.atlassian.com/users/8b3597e8a7d1d8f2ed7f58bcab1946b8/avatar" alt="Your Character">
</div>
</div>
<script>
const hatButton = document.getElementById('hat-man');
const happyButton = document.getElementById('happy-man');
const coolButton = document.getElementById('cool-man');
const madButton = document.getElementById('box-man');
const coolerButton = document.getElementById('cooler-man');
const invisibleButton = document.getElementById('invisible-man');
const picture = document.querySelector('img');
const characterName = document.querySelector('.character-name');
hatButton.addEventListener('click', function(){
picture.src='images/hat-man.png';
picture.alt='Image of hat man, wearing a PNG of a small hat';
characterName.textContent = "Your Character: Hat Man";
});
happyButton.addEventListener('click', function(){
picture.src='images/happy-man.png';
picture.alt='Image of happy man, with a great smile.';
characterName.textContent = "Your Character: Happy Man";
});
coolButton.addEventListener('click', function(){
picture.src='images/cool-man.png';
picture.alt='Image of cool man, he has a cool hat';
characterName.textContent = "Your Character: Cool Man";
});
madButton.addEventListener('click', function(){
picture.src='images/box-man.png';
picture.alt='Image of box man, with a boxy head';
characterName.textContent = "Your Character: Box Man";
});
coolerButton.addEventListener('click', function(){
picture.src='images/cooler-man.png';
picture.alt='Image of cooler man, he has a cool hat AND shades';
characterName.textContent = "Your Character: Cooler Man";
});
invisibleButton.addEventListener('click', function(){
picture.src='images/invisible-man.png';
picture.alt='Image of invisible man, where is he?';
characterName.textContent = "Your Character: Invisible Man";
});
</script>
</body>