-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
25 lines (21 loc) · 928 Bytes
/
index.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
let currentCard = 0; // Start from the first card
function showNextCard() {
const cardContainer = document.getElementById("card-container"); // Corrected the id
const cards = document.querySelectorAll(".sec3card");
if (currentCard < cards.length - 1) {
cards[currentCard].style.display = "none";
currentCard++;
cards[currentCard].style.display = "block"; // Use 'block' or 'inline-block' to show the card
cardContainer.scrollLeft += cards[currentCard].offsetWidth;
}
}
function showPreviousCard() {
const cardContainer = document.getElementById("card-container"); // Corrected the id
const cards = document.querySelectorAll(".sec3card");
if (currentCard > 0) {
cards[currentCard].style.display = "none";
currentCard--;
cards[currentCard].style.display = "block"; // Use 'block' or 'inline-block' to show the card
cardContainer.scrollLeft -= cards[currentCard].offsetWidth;
}
}