/
index.html
60 lines (49 loc) · 1.19 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
<!DOCTYPE html>
<html>
<head>
<title>gallery</title>
<style>
.galleryImg{
width: 25%;
float: left;
position: relative;
}
.galleryImg > img{
width: 100%;
}
.galleryImg:hover > img{
position: absolute;
left: 0px;
top: 0px;
z-index: 1;
width: 50vw;
}
</style>
</head>
<body>
</body>
<script>
var images = [
//add images here based on photos in the images folder.
//each image name needs to be a string
//remember, the images are in a folder called "image"
];
// call one of the functions below. Give it an argument of the
// images array above
/******** you don't need to modify anything below this line ******/
function displayImagesInGallery(imageArray){
for(var imageIndex = 0; imageIndex < imageArray.length; imageIndex++){
var image = createImageElement(imageArray[imageIndex]);
document.querySelector('body').appendChild(image);
}
}
function createImageElement(imgSource){
var imgContainer = document.createElement('FIGURE');
imgContainer.className = "galleryImg"
var imgElement = document.createElement('IMG');
imgElement.src = imgSource;
imgContainer.appendChild(imgElement)
return imgContainer;
}
</script>
</html>