2026-06-02 18:13:50 +02:00
|
|
|
const slidersData = [
|
|
|
|
|
[
|
|
|
|
|
{ title: '1980 - Mexico', caption: 'Occasion', photographer: 'Name of photographer' },
|
|
|
|
|
{ title: '1980 - Mexico', caption: 'Occasion', photographer: 'Name of photographer' },
|
|
|
|
|
{ title: '1986 - Buenos Aires', caption: 'Occasion', photographer: 'Name of photographer' },
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
{ title: '2000 - Barcelona', caption: 'Occasion', photographer: 'Name of photographer' },
|
|
|
|
|
{ title: '2004 - Seoul', caption: 'Occasion', photographer: 'Name of photographer' },
|
|
|
|
|
{ title: '2007 - Vienna', caption: 'Occasion', photographer: 'Name of photographer' },
|
|
|
|
|
{ title: '2010 - Shanghai', caption: 'Occasion', photographer: 'Name of photographer' },
|
|
|
|
|
{ title: '2013 - Rio', caption: 'Occasion', photographer: 'Name of photographer' },
|
|
|
|
|
],
|
2026-06-02 17:17:30 +02:00
|
|
|
];
|
|
|
|
|
|
2026-06-02 18:13:50 +02:00
|
|
|
document.querySelectorAll('.poster-slider').forEach((section, i) => {
|
|
|
|
|
const swiperEl = section.querySelector('.poster-swiper');
|
|
|
|
|
const titleEl = section.querySelector('.slide-info .title');
|
|
|
|
|
const captionEl = section.querySelector('.slide-info .caption');
|
|
|
|
|
const data = slidersData[i] ?? [];
|
|
|
|
|
const slideCount = swiperEl.querySelectorAll('.swiper-slide').length;
|
|
|
|
|
const initialSlide = Math.floor(slideCount / 2);
|
2026-06-02 17:17:30 +02:00
|
|
|
|
2026-06-02 18:13:50 +02:00
|
|
|
const swiper = new Swiper(swiperEl, {
|
|
|
|
|
slidesPerView: 3,
|
|
|
|
|
centeredSlides: true,
|
|
|
|
|
spaceBetween: 16,
|
|
|
|
|
loop: false,
|
|
|
|
|
initialSlide,
|
|
|
|
|
keyboard: { enabled: true },
|
|
|
|
|
navigation: {
|
|
|
|
|
nextEl: section.querySelector('.poster-next'),
|
|
|
|
|
prevEl: section.querySelector('.poster-prev'),
|
|
|
|
|
},
|
|
|
|
|
});
|
2026-06-02 17:17:30 +02:00
|
|
|
|
2026-06-02 18:13:50 +02:00
|
|
|
function updateInfo() {
|
|
|
|
|
const entry = data[swiper.realIndex];
|
|
|
|
|
if (!entry || !titleEl || !captionEl) return;
|
|
|
|
|
titleEl.textContent = entry.title;
|
|
|
|
|
captionEl.innerHTML = `${entry.caption}<br>${entry.photographer}`;
|
|
|
|
|
}
|
2026-06-02 17:17:30 +02:00
|
|
|
|
2026-06-02 18:13:50 +02:00
|
|
|
swiper.on('slideChange', updateInfo);
|
|
|
|
|
updateInfo();
|
|
|
|
|
});
|