forked from CodeCrew-CodeSchool/codeschool-winter24-module-2-week3_day_05_bonus-module02_week03_day05
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
258 lines (195 loc) · 7.86 KB
/
index.html
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<!DOCTYPE html>
<html>
<style>
#header {
display: flex;
justify-content: center;
}
#content {
display: flex;
flex-direction: column;
align-items: center;
}
#mainDisplay{
margin-top: 3%;
}
#mainDisplay img {
width: 50vh;
border: 3px solid black;
}
#thumbnailsContainer {
display: flex;
justify-content: space-evenly;
flex-wrap: wrap;
/* margin-top: 5%; */
}
.thumbnail {
position: relative; /* Set position context for absolute positioning of the button */
margin: 5px;
display: flex;
flex-direction: column;
align-items: center;
background-color: gray;
border: 3px solid black;
}
.thumbnail img {
margin: 0;
width: 10vh;
object-fit: cover; /* This will make sure to cover the area without stretching the image */
}
.thumbnail button {
position: absolute; /* Position the button over the image */
top: 50%;
left: 50%;
transform: translate(-50%, -50%); /* Center the button */
display: none;
}
</style>
<body style="background-color: cornsilk;">
<div id='header'>
<h1>Aspen's Adventure Gallery</h1>
</div>
<div id='content'>
<div id="mainDisplay">
<img id="mainDisplayImage" src="assets/placeholder.png"/>
</div>
<h3>Select an image to view</h3>
<div id='thumbnailsContainer'>
<div id="thumbnail1" class='thumbnail'>
<img src="assets/Aspen1.jpg" class="thumbnailImage">
<button id="thumbnail1Button">View</button>
</div>
<div id="thumbnail2" class='thumbnail'>
<img src="assets/Aspen2.jpg" class="thumbnailImage">
<button id="thumbnail2Button">View</button>
</div>
<div id="thumbnail3" class='thumbnail'>
<img src="assets/Aspen3.jpg" class="thumbnailImage">
<button id="thumbnail3Button">View</button>
</div>
<div id="thumbnail4" class='thumbnail'>
<img src="assets/Aspen4.jpg" class="thumbnailImage">
<button id="thumbnail4Button">View</button>
</div>
<div id="thumbnail5" class='thumbnail'>
<img src="assets/Aspen5.jpg" class="thumbnailImage">
<button id="thumbnail5Button">View</button>
</div>
<div id="thumbnail6" class='thumbnail'>
<img src="assets/Aspen6.jpg" class="thumbnailImage">
<button id="thumbnail6Button">View</button>
</div>
<div id="thumbnail7" class='thumbnail'>
<img src="assets/Aspen7.jpg" class="thumbnailImage">
<button id="thumbnail7Button">View</button>
</div>
<div id="thumbnail8" class='thumbnail'>
<img src="assets/Aspen8.jpg" class="thumbnailImage">
<button id="thumbnail8Button">View</button>
</div>
</div>
</div>
</body>
<script>
// PART 1
let thumbnail1ButtonHTML = document.getElementById("thumbnail1Button")
thumbnail1ButtonHTML.addEventListener("click", function(){
//*** YOUR JAVASCRIPT CODE HERE ***
let mainDisplayImageHTML = document.getElementById("mainDisplayImage")
mainDisplayImageHTML.src = "assets/Aspen1.jpg"
})
let thumbnail2ButtonHTML = document.getElementById("thumbnail2Button")
thumbnail2ButtonHTML.addEventListener("click", function(){
//*** YOUR JAVASCRIPT CODE HERE ***
let mainDisplayImageHTML = document.getElementById("mainDisplayImage")
mainDisplayImageHTML.src = "assets/Aspen2.jpg"
})
let thumbnail3ButtonHTML = document.getElementById("thumbnail3Button")
thumbnail3ButtonHTML.addEventListener("click", function(){
//*** YOUR JAVASCRIPT CODE HERE ***
let mainDisplayImageHTML = document.getElementById("mainDisplayImage")
mainDisplayImageHTML.src = "assets/Aspen3.jpg"
})
let thumbnail4ButtonHTML = document.getElementById("thumbnail4Button")
thumbnail4ButtonHTML.addEventListener("click", function(){
let mainDisplayImageHTML = document.getElementById("mainDisplayImage")
mainDisplayImageHTML.src = "assets/Aspen4.jpg"
})
let thumbnail5ButtonHTML = document.getElementById("thumbnail5Button")
thumbnail5ButtonHTML.addEventListener("click", function(){
let mainDisplayImageHTML = document.getElementById("mainDisplayImage")
mainDisplayImageHTML.src = "assets/Aspen5.jpg"
})
let thumbnail6ButtonHTML = document.getElementById("thumbnail6Button")
thumbnail6ButtonHTML.addEventListener("click", function(){
let mainDisplayImageHTML = document.getElementById("mainDisplayImage")
mainDisplayImageHTML.src = "assets/Aspen6.jpg"
})
let thumbnail7ButtonHTML = document.getElementById("thumbnail7Button")
thumbnail7ButtonHTML.addEventListener("click", function(){
let mainDisplayImageHTML = document.getElementById("mainDisplayImage")
mainDisplayImageHTML.src = "assets/Aspen7.jpg"
})
let thumbnail8ButtonHTML = document.getElementById("thumbnail8Button")
thumbnail8ButtonHTML.addEventListener("click", function(){
let mainDisplayImageHTML = document.getElementById("mainDisplayImage")
mainDisplayImageHTML.src = "assets/Aspen8.jpg"
})
let thumbnail1HTML = document.getElementById("thumbnail1")
thumbnail1HTML.addEventListener("mouseenter", function(){
thumbnail1ButtonHTML.style.display = "block"
})
thumbnail1HTML.addEventListener("mouseleave", function(){
thumbnail1ButtonHTML.style.display = "none"
})
let thumbnail2HTML = document.getElementById("thumbnail2")
thumbnail2HTML.addEventListener("mouseenter", function(){
thumbnail2ButtonHTML.style.display = "block"
})
thumbnail2HTML.addEventListener("mouseleave", function(){
thumbnail2ButtonHTML.style.display = "none"
})
let thumbnail3HTML = document.getElementById("thumbnail3")
thumbnail3HTML.addEventListener("mouseenter", function(){
thumbnail3ButtonHTML.style.display = "block"
})
thumbnail3HTML.addEventListener("mouseleave", function(){
thumbnail3ButtonHTML.style.display = "none"
})
let thumbnail4HTML = document.getElementById("thumbnail4")
thumbnail4HTML.addEventListener("mouseenter", function(){
thumbnail4ButtonHTML.style.display = "block"
})
thumbnail4HTML.addEventListener("mouseleave", function(){
thumbnail4ButtonHTML.style.display = "none"
})
let thumbnail5HTML = document.getElementById("thumbnail5")
thumbnail5HTML.addEventListener("mouseenter", function(){
thumbnail5ButtonHTML.style.display = "block"
})
thumbnail5HTML.addEventListener("mouseleave", function(){
thumbnail5ButtonHTML.style.display = "none"
})
let thumbnail6HTML = document.getElementById("thumbnail6")
thumbnail6HTML.addEventListener("mouseenter", function(){
thumbnail6ButtonHTML.style.display = "block"
})
thumbnail6HTML.addEventListener("mouseleave", function(){
thumbnail6ButtonHTML.style.display = "none"
})
let thumbnail7HTML = document.getElementById("thumbnail7")
thumbnail7HTML.addEventListener("mouseenter", function(){
thumbnail7ButtonHTML.style.display = "block"
})
thumbnail7HTML.addEventListener("mouseleave", function(){
thumbnail7ButtonHTML.style.display = "none"
})
let thumbnail8HTML = document.getElementById("thumbnail8")
thumbnail8HTML.addEventListener("mouseenter", function(){
thumbnail8ButtonHTML.style.display = "block"
})
thumbnail8HTML.addEventListener("mouseleave", function(){
thumbnail8ButtonHTML.style.display = "none"
})
</script>
</html>