-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1247 from Jordian0/branchj
Fixing carousel indicators in about section.
- Loading branch information
Showing
3 changed files
with
58 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
const slides = document.querySelector('.slides'); | ||
const radioButtons = document.querySelectorAll('input[name="radio-btn"]'); | ||
const labels = document.querySelectorAll('.manual-btn'); | ||
let currentSlide = 0; | ||
|
||
function showSlide(index) { | ||
slides.style.transform = `translateX(-${index * 14.29}%)`; | ||
radioButtons[index].checked = true; | ||
updateActiveLabel(index); | ||
} | ||
|
||
function updateActiveLabel(index) { | ||
labels.forEach((label, i) => { | ||
if (i === index) { | ||
label.classList.add('active'); | ||
} else { | ||
label.classList.remove('active'); | ||
} | ||
}); | ||
} | ||
|
||
function nextSlide() { | ||
currentSlide = (currentSlide + 1) % radioButtons.length; | ||
showSlide(currentSlide); | ||
} | ||
|
||
// Add click event listeners to radio buttons | ||
radioButtons.forEach((radio, index) => { | ||
radio.addEventListener('click', () => { | ||
currentSlide = index; | ||
showSlide(currentSlide); | ||
}); | ||
}); | ||
|
||
// Show first slide initially | ||
showSlide(0); | ||
|
||
// Automatic slide change | ||
setInterval(nextSlide, 5000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7bbe0a1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
word-wise – ./
word-wise-anshikas-projects-45924011.vercel.app
word-wise-pi.vercel.app
word-wise-git-main-anshikas-projects-45924011.vercel.app