-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
31 lines (25 loc) · 1.18 KB
/
main.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
pictures = ["./carousel_images/group1.JPG", "./carousel_images/group2.JPG", "./carousel_images/group3.JPG", "./carousel_images/group4.JPG", "./carousel_images/getting_ids.jpg", "./carousel_images/audible_studios.png", "./carousel_images/bri_questions.jpg", "./carousel_images/coding_is_fun.jpg", "./carousel_images/love_puzzles.jpg", "./carousel_images/tech_day.png", "./carousel_images/walking-in.jpg", "./carousel_images/brianna_smiling.JPG", "./carousel_images/bri_typing.JPG", "./carousel_images/jennah_typing.JPG", "./carousel_images/jennah_typing2.JPG", "./carousel_images/nessa_typing.JPG"]
function lastPic() {
var getImage = document.getElementById("image");
var imgSrc = image.getAttribute("src");
var imgIndex = pictures.indexOf(imgSrc);
if(imgIndex === 0){
imgIndex = pictures.length - 1;
} else {
imgIndex -= 1;
}
imgSrc = pictures[imgIndex];
image.src = imgSrc;
}
function nextPic() {
var getImage = document.getElementById("image");
var imgSrc = image.getAttribute("src");
var imgIndex = pictures.indexOf(imgSrc);
if(imgIndex === pictures.length - 1){
imgIndex = 0;
} else {
imgIndex += 1;
}
imgSrc = pictures[imgIndex];
image.src = imgSrc;
}