mirror of
https://github.com/System-End/riceathon.git
synced 2026-04-19 22:05:16 +00:00
Prettified Code!
This commit is contained in:
parent
efb595b161
commit
baaaabc11b
2 changed files with 33 additions and 33 deletions
|
|
@ -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 };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue