Skip to content

Commit aced6fc

Browse files
committed
reinstate files
1 parent 6e37b5a commit aced6fc

2 files changed

Lines changed: 4 additions & 76 deletions

File tree

‎Sprint-3/quote-generator/quotes.js‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ function pickFromArray(choices) {
2222

2323
// A list of quotes you can use in your app.
2424
// DO NOT modify this array, otherwise the tests may break!
25-
2625
const quotes = [
2726
{
2827
quote: "Life isn't about getting and having, it's about giving and being.",
@@ -490,20 +489,5 @@ const quotes = [
490489
author: "Zig Ziglar",
491490
},
492491
];
493-
function displayQuote() {
494-
const quoteElement = document.getElementById("quote");
495-
const authorElement = document.getElementById("author");
496-
497-
const randomQuote = pickFromArray(quotes);
498-
499-
quoteElement.innerText = randomQuote.quote;
500-
authorElement.innerText = randomQuote.author;
501-
}
502-
503-
const newQuoteButton = document.getElementById("new-quote");
504-
505-
newQuoteButton.addEventListener("click", displayQuote);
506-
507-
displayQuote();
508492

509493
// call pickFromArray with the quotes array to check you get a random quote

‎Sprint-3/slideshow/slideshow.js‎

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,8 @@
11
const images = [
2-
"./assets/cute-cat-a.png",
3-
"./assets/cute-cat-b.jpg",
4-
"./assets/cute-cat-c.jpg",
2+
"./assets/cute-cat-a.png",
3+
"./assets/cute-cat-b.jpg",
4+
"./assets/cute-cat-c.jpg",
55
];
66

7-
let currentIndex = 0;
8-
let timer = null;
97

10-
const image = document.querySelector("#carousel-img");
11-
const forwardBtn = document.querySelector("#forward-btn");
12-
const backwardBtn = document.querySelector("#backward-btn");
13-
const autoForwardBtn = document.querySelector("#auto-forward");
14-
const autoBackBtn = document.querySelector("#auto-backward");
15-
const stopBtn = document.querySelector("#stop");
16-
17-
// Display the current image
18-
function displayImage() {
19-
image.src = images[currentIndex];
20-
}
21-
22-
// Move forward
23-
function moveForward() {
24-
currentIndex = (currentIndex + 1) % images.length;
25-
displayImage();
26-
}
27-
28-
// Move backward
29-
function moveBackward() {
30-
currentIndex = (currentIndex - 1 + images.length) % images.length;
31-
displayImage();
32-
}
33-
34-
// Manual controls
35-
forwardBtn.addEventListener("click", moveForward);
36-
backwardBtn.addEventListener("click", moveBackward);
37-
38-
// Automatic forward
39-
autoForwardBtn.addEventListener("click", () => {
40-
timer = setInterval(moveForward, 2000);
41-
42-
autoForwardBtn.disabled = true;
43-
autoBackBtn.disabled = true;
44-
});
45-
46-
// Automatic backward
47-
autoBackBtn.addEventListener("click", () => {
48-
timer = setInterval(moveBackward, 2000);
49-
50-
autoForwardBtn.disabled = true;
51-
autoBackBtn.disabled = true;
52-
});
53-
54-
// Stop automatic movement
55-
stopBtn.addEventListener("click", () => {
56-
clearInterval(timer);
57-
timer = null;
58-
59-
autoForwardBtn.disabled = false;
60-
autoBackBtn.disabled = false;
61-
});
62-
63-
// Show first image when page loads
64-
displayImage();
8+
// Write your code here

0 commit comments

Comments
 (0)