diff --git a/Sprint-3/slideshow-extra/assets/butterfly1.png b/Sprint-3/slideshow-extra/assets/butterfly1.png new file mode 100644 index 000000000..d47c18ef9 Binary files /dev/null and b/Sprint-3/slideshow-extra/assets/butterfly1.png differ diff --git a/Sprint-3/slideshow-extra/assets/butterfly2.png b/Sprint-3/slideshow-extra/assets/butterfly2.png new file mode 100644 index 000000000..db86f10bc Binary files /dev/null and b/Sprint-3/slideshow-extra/assets/butterfly2.png differ diff --git a/Sprint-3/slideshow-extra/assets/butterfly3.png b/Sprint-3/slideshow-extra/assets/butterfly3.png new file mode 100644 index 000000000..78f16edd8 Binary files /dev/null and b/Sprint-3/slideshow-extra/assets/butterfly3.png differ diff --git a/Sprint-3/slideshow-extra/assets/cute-cat-a.png b/Sprint-3/slideshow-extra/assets/cute-cat-a.png new file mode 100644 index 000000000..a853b8def Binary files /dev/null and b/Sprint-3/slideshow-extra/assets/cute-cat-a.png differ diff --git a/Sprint-3/slideshow-extra/assets/cute-cat-b.jpg b/Sprint-3/slideshow-extra/assets/cute-cat-b.jpg new file mode 100644 index 000000000..ade296856 Binary files /dev/null and b/Sprint-3/slideshow-extra/assets/cute-cat-b.jpg differ diff --git a/Sprint-3/slideshow-extra/assets/cute-cat-c.jpg b/Sprint-3/slideshow-extra/assets/cute-cat-c.jpg new file mode 100644 index 000000000..3546f7336 Binary files /dev/null and b/Sprint-3/slideshow-extra/assets/cute-cat-c.jpg differ diff --git a/Sprint-3/slideshow-extra/index.html b/Sprint-3/slideshow-extra/index.html new file mode 100644 index 000000000..2d9388fb1 --- /dev/null +++ b/Sprint-3/slideshow-extra/index.html @@ -0,0 +1,21 @@ + + +
+ + +
+
+
+
+
+
+
+
diff --git a/Sprint-3/slideshow-extra/slideshow-extra.js b/Sprint-3/slideshow-extra/slideshow-extra.js
new file mode 100644
index 000000000..da88175ca
--- /dev/null
+++ b/Sprint-3/slideshow-extra/slideshow-extra.js
@@ -0,0 +1,68 @@
+const images = [
+ "./assets/butterfly1.png",
+ "./assets/butterfly2.png",
+ "./assets/butterfly3.png",
+ "./assets/cute-cat-a.png",
+ "./assets/cute-cat-b.jpg",
+ "./assets/cute-cat-c.jpg",
+];
+// Write your code here
+
+const imageElement = document.getElementById("carousel-img");
+const forwardBtn = document.getElementById("forward-btn");
+const backwardBtn = document.getElementById("backward-btn");
+const autoForwardBtn = document.getElementById("auto-forward");
+const autoBackwardBtn = document.getElementById("auto-backward");
+const stopBtn = document.getElementById("stop");
+const delayInput = document.getElementById("delay");
+
+let currentIndex = 0;
+imageElement.src = images[currentIndex];
+
+function showNextImage() {
+ currentIndex++;
+ if (currentIndex >= images.length) {
+ currentIndex = 0;
+ }
+ imageElement.src = images[currentIndex];
+}
+
+function showPreviousImage() {
+ currentIndex--;
+ if (currentIndex < 0) {
+ currentIndex = images.length - 1;
+ }
+ imageElement.src = images[currentIndex];
+}
+
+let autoForwardInterval;
+function startAutoForward() {
+ autoForwardBtn.disabled = true;
+ autoBackwardBtn.disabled = true;
+
+ const delay = Number(delayInput.value);
+
+ autoForwardInterval = setInterval(showNextImage, delay);
+}
+let autoBackwardInterval;
+function startAutoBackward() {
+ autoForwardBtn.disabled = true;
+ autoBackwardBtn.disabled = true;
+
+ const delay = Number(delayInput.value);
+
+ autoBackwardInterval = setInterval(showPreviousImage, delay);
+}
+
+function stopAutoSlideshow() {
+ clearInterval(autoForwardInterval);
+ clearInterval(autoBackwardInterval);
+ autoForwardBtn.disabled = false;
+ autoBackwardBtn.disabled = false;
+}
+
+forwardBtn.addEventListener("click", showNextImage);
+backwardBtn.addEventListener("click", showPreviousImage);
+autoForwardBtn.addEventListener("click", startAutoForward);
+autoBackwardBtn.addEventListener("click", startAutoBackward);
+stopBtn.addEventListener("click", stopAutoSlideshow);
diff --git a/Sprint-3/slideshow-extra/style.css b/Sprint-3/slideshow-extra/style.css
new file mode 100644
index 000000000..106b30f66
--- /dev/null
+++ b/Sprint-3/slideshow-extra/style.css
@@ -0,0 +1,93 @@
+body {
+ font-family: Arial, sans-serif;
+ background-color: #f9f9f9;
+ margin: 0;
+ padding: 20px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 100vh;
+ color: #333;
+}
+
+.container {
+ background-color: white;
+ padding: 30px;
+ border-radius: 10px;
+ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
+ width: 100%;
+ max-width: 800px;
+ text-align: center;
+}
+
+img {
+ width: 100%;
+ max-width: 600px;
+ height: auto;
+ margin-bottom: 20px;
+ border-radius: 10px;
+ border: 4px solid #ddd;
+}
+
+button {
+ padding: 12px 24px;
+ font-size: 16px;
+ cursor: pointer;
+ background-color: #4caf50;
+ color: white;
+ border: none;
+ border-radius: 5px;
+ margin: 10px;
+ transition: background-color 0.3s;
+}
+
+button:hover {
+ background-color: #45a049;
+}
+
+button:disabled {
+ background-color: #ddd;
+ cursor: not-allowed;
+}
+
+label {
+ font-size: 16px;
+ color: #666;
+ display: block;
+ margin: 20px 0 5px;
+ font-weight: bold;
+}
+
+input[type="number"] {
+ padding: 10px;
+ font-size: 16px;
+ width: 150px;
+ margin-bottom: 20px;
+ border-radius: 5px;
+ border: 2px solid #ddd;
+ box-sizing: border-box;
+}
+
+input[type="number"]:focus {
+ border-color: #4caf50;
+ outline: none;
+}
+
+@media (max-width: 600px) {
+ .container {
+ padding: 20px;
+ }
+
+ button {
+ width: 100%;
+ margin: 10px 0;
+ }
+
+ input[type="number"] {
+ width: 100%;
+ }
+
+ img {
+ max-width: 100%;
+ }
+}