logo carousel fix
This commit is contained in:
parent
1e42624fea
commit
91ab0400d6
|
@ -1,23 +1,24 @@
|
|||
const collapsibleButton = document.querySelector("#hamburger-menu");
|
||||
const menuContent = document.querySelector(".menu-content");
|
||||
collapsibleButton.addEventListener("click", function () {
|
||||
menuContent.classList.toggle("active");
|
||||
if (menuContent.style.display === "block") {
|
||||
menuContent.style.display = "none";
|
||||
} else {
|
||||
menuContent.style.display = "block";
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const collapsibleButton = document.querySelector("#hamburger-menu");
|
||||
const menuContent = document.querySelector(".menu-content");
|
||||
collapsibleButton.addEventListener("click", function () {
|
||||
menuContent.classList.toggle("active");
|
||||
if (menuContent.style.display === "block") {
|
||||
menuContent.style.display = "none";
|
||||
} else {
|
||||
menuContent.style.display = "block";
|
||||
}
|
||||
});
|
||||
|
||||
initializeCompaniesCarousel();
|
||||
fetch('../assets/js/carousel-items.json')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
createCarouselItems(data);
|
||||
initializeCarousel();
|
||||
})
|
||||
.catch(error => console.error('Error loading JSON:', error));
|
||||
// TODO: useful for news article carousel
|
||||
// fetch('../assets/js/carousel-items.json')
|
||||
// .then(response => response.json())
|
||||
// .then(data => {
|
||||
// createCarouselItems(data);
|
||||
// initializeCarousel();
|
||||
// })
|
||||
// .catch(error => console.error('Error loading JSON:', error));
|
||||
});
|
||||
|
||||
function createCarouselItems(items) {
|
||||
|
@ -68,7 +69,6 @@ function initializeCarousel() {
|
|||
function initializeCompaniesCarousel() {
|
||||
const slider = document.getElementById('logoSlider');
|
||||
|
||||
// Duplicate the existing logos by appending the same HTML again:
|
||||
slider.innerHTML += slider.innerHTML;
|
||||
|
||||
let offset = 0;
|
||||
|
@ -78,7 +78,6 @@ function initializeCompaniesCarousel() {
|
|||
offset -= speed;
|
||||
slider.style.transform = `translateX(${offset}px)`;
|
||||
|
||||
// After half of the total (2 sets) is scrolled, reset
|
||||
if (Math.abs(offset) >= slider.scrollWidth / 2) {
|
||||
offset = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue