le-courage-du-reel/assets/js/script.js
isUnknown f7f3d0f0b5 feat: add mobile burger menu, SEO meta tags, and various fixes
- Add burger menu with open/close animation and scroll lock
- Add nav-logo element for mobile header
- Hide nav links on mobile, reveal in fullscreen overlay
- Add title, meta description, Open Graph and Twitter Card tags
- Add canonical URL
- Various SCSS adjustments (hero line-height, excerpt font-weight)
- Fix asset paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:19:28 +01:00

63 lines
1.5 KiB
JavaScript

document.addEventListener('DOMContentLoaded', function () {
// ---- MOBILE NAV ----
const header = document.querySelector('body > header');
const burger = header.querySelector('.burger');
const navLinks = header.querySelectorAll('nav ul a');
burger.addEventListener('click', function () {
header.classList.toggle('nav-open');
document.body.classList.toggle('no-scroll');
});
navLinks.forEach(function (link) {
link.addEventListener('click', function () {
if (!header.classList.contains('nav-open')) return;
header.classList.remove('nav-open');
document.body.classList.remove('no-scroll');
});
});
const excerptSwiper = new Swiper('.excerpts-swiper', {
// Slides visibles et groupement
slidesPerView: 3,
slidesPerGroup: 3,
spaceBetween: 30,
// Infinite loop
loop: true,
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// Pagination bullets
pagination: {
el: '.swiper-pagination',
clickable: true,
dynamicBullets: false,
},
// Transitions
speed: 400,
effect: 'slide',
// Responsive breakpoints
breakpoints: {
// Mobile : <= 768px
0: {
slidesPerView: 1,
slidesPerGroup: 1,
spaceBetween: 20,
},
// Desktop : > 768px
769: {
slidesPerView: 3,
slidesPerGroup: 3,
spaceBetween: 30,
}
}
});
});