Prettified Code!

This commit is contained in:
NeonGamerBot-QK 2024-12-31 06:20:18 +00:00 committed by Saahil
parent efb595b161
commit baaaabc11b
2 changed files with 33 additions and 33 deletions

View file

@ -1,24 +1,24 @@
function setupCarousel() {
let currentSlide = 0;
const slides = document.querySelectorAll('.carousel img');
const totalSlides = slides.length;
function moveSlide(direction) {
currentSlide += direction;
if (currentSlide < 0) {
currentSlide = totalSlides - 1;
} else if (currentSlide >= totalSlides) {
currentSlide = 0;
}
updateCarouselPosition();
}
function updateCarouselPosition() {
const carousel = document.querySelector('.carousel');
const offset = -currentSlide * 100;
carousel.style.transform = `translateX(${offset}%)`;
}
return { moveSlide }
}
function setupCarousel() {
let currentSlide = 0;
const slides = document.querySelectorAll(".carousel img");
const totalSlides = slides.length;
function moveSlide(direction) {
currentSlide += direction;
if (currentSlide < 0) {
currentSlide = totalSlides - 1;
} else if (currentSlide >= totalSlides) {
currentSlide = 0;
}
updateCarouselPosition();
}
function updateCarouselPosition() {
const carousel = document.querySelector(".carousel");
const offset = -currentSlide * 100;
carousel.style.transform = `translateX(${offset}%)`;
}
return { moveSlide };
}

View file

@ -1,9 +1,9 @@
function setupIcon(iconf, el ) {
const icon = document.createElement('img')
icon.src = "./icons/"+iconf+".png"
// icon.width = "20px"
// icon.height = "20px"
icon.style.width = "40px"
icon.style.height = "40px"
return el ? el.appendChild(icon) : icon
}
function setupIcon(iconf, el) {
const icon = document.createElement("img");
icon.src = "./icons/" + iconf + ".png";
// icon.width = "20px"
// icon.height = "20px"
icon.style.width = "40px";
icon.style.height = "40px";
return el ? el.appendChild(icon) : icon;
}