-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
81 lines (75 loc) · 1.92 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
body{
margin: 0;
padding: 5% 5% 1% 5%;
box-sizing: border-box;
background-color: rgb(0, 0, 0);
}
#slide-container{
width: 60vw;
position: relative;
margin: 0 auto;
box-shadow: 5px 5px 10px rgb(255, 255, 255),
-5px -5px 10px rgb(255, 255, 255);
}
#slide-container img{
width: 100%;
margin: 0;
padding: 0;
}
.arrow{
position: absolute;
color: rgb(255, 255, 255);
font-size: 10vw;
top: 35%;
padding: 0% 1% 2% 1%;
text-align: center;
justify-content: center;
align-items: center;
cursor: pointer;
height: auto;
}
.arrow:hover{
background-color: #00000054;
}
.prev{
left: 1%;
}
.next{
right: 1%;
}
</style>
<body>
<div id="slide-container">
<img src="Images/7.jpg" alt="" id="img">
<span class="arrow prev" onclick="prev()">‹</span>
<span class="arrow next" onclick="next()">›</span>
</div>
<script>
const images = document.getElementById("img");
let imagesArray = ["Images/1.jpg", "Images/2.jpg", "Images/3.jpg", "Images/4.jpg", "Images/5.jpg", "Images/6.jpg", "Images/7.jpg",];
let i = 0;
function next() {
i++;
// if(i > imagesArray.length - 1)
if(i === imagesArray.length)
i = 0;
images.src = imagesArray[i];
}
function prev() {
i--;
if(i < 0)
i = imagesArray.length - 1 ;
images.src = imagesArray[i];
}
</script>
</body>
</html>