-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
134 lines (120 loc) · 3.73 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
/>
<style>
body {
background-color: #2c3e50;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
#imageCard {
width: 400px;
background-color: #061726;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
#imageContainer {
position: relative;
overflow: hidden;
border-radius: 0px;
}
#imageSlider {
width: 100%;
transition: transform 0.5s ease-in-out;
display: flex; /* Enable flex container for images */
}
.image {
width: 100%;
max-width: 100%; /* Ensures the image doesn't exceed its container */
height: auto; /* Maintains the image's aspect ratio */
flex: 0 0 auto; /* Prevents images from shrinking or growing */
}
#progressBarContainer {
position: relative;
width: 100%;
height: 50px;
background-color: #000312;
border-radius: 0px 0px 10px 10px;
overflow: hidden;
}
#progressBar {
height: 100%;
width: 0;
background-color: #4f7728;
transition: width 0.5s ease-in-out;
}
#slideCount {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-size: 14px;
z-index: 1;
font-size: 30px;
font-weight: bolder;
}
</style>
</head>
<body>
<div id="imageCard">
<div id="imageContainer">
<div id="imageSlider">
<!-- Embed images directly in the HTML -->
<img src="slides/image1.png" class="image" />
<img src="slides/image2.png" class="image" />
<!-- Add more images as needed -->
</div>
</div>
<div id="progressBarContainer">
<div id="progressBar"></div>
<div id="slideCount">0/0</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script>
let currentSlide = 0;
let totalSlides = $("#imageSlider img").length;
const imageSlider = $("#imageSlider");
const progressBar = $("#progressBar");
const slideCount = $("#slideCount");
// Function to start the slideshow
function startSlideshow() {
setInterval(() => {
currentSlide = (currentSlide + 1) % totalSlides;
updateSlideCount();
updateProgressBar();
updateSliderPosition();
}, 5000); // Change the interval as per your preference
}
// Function to update the slide count
function updateSlideCount() {
slideCount.text(`${currentSlide + 1}/${totalSlides}`);
}
// Function to update the progress bar
function updateProgressBar() {
const progress = ((currentSlide + 1) / totalSlides) * 100;
progressBar.css("width", `${progress}%`);
}
// Function to update the slider position
function updateSliderPosition() {
const newPosition = -currentSlide * 100 + "%";
imageSlider.css("transform", `translateX(${newPosition})`);
}
// Initialize the overlay
startSlideshow();
</script>
</body>
</html>