better chapitres hover, js clean

This commit is contained in:
2026-02-04 11:31:15 +01:00
parent 81bf66acff
commit 752868639c
4 changed files with 27 additions and 19 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -59,11 +59,12 @@ gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
function initPartieFrontBackCardSwitch() { function initPartieFrontBackCardSwitch() {
let principes_pratique = document.getElementById('partie-principes-pratique'); let principes_pratique = document.getElementById('partie-principes-pratique');
if (principes_pratique) {
let cards = principes_pratique.getElementsByClassName('field-card'); let cards = principes_pratique.getElementsByClassName('field-card');
console.log('cards', cards); // console.log('cards', cards);
for (const card of cards) { for (const card of cards) {
card.addEventListener('mousemove', function (e) { card.addEventListener('mousemove', function (e) {
console.log(this, e); // console.log(this, e);
for (const child of this.parentElement.children){ for (const child of this.parentElement.children){
child.classList.add('back-card') child.classList.add('back-card')
child.classList.remove('front-card'); child.classList.remove('front-card');
@@ -74,6 +75,8 @@ gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
} }
} }
}
function initBgAnime(){ function initBgAnime(){
// gsap.to('body', { // gsap.to('body', {
// scrollTrigger: 'main[role="main"]', // start animation when ".box" enters the viewport // scrollTrigger: 'main[role="main"]', // start animation when ".box" enters the viewport
@@ -10,12 +10,17 @@
display: block; display: block;
font-size: 0.756em; font-size: 0.756em;
padding:0 0 0.25em 0; padding:0 0 0.25em 0;
transition: color 0.25s ease-out;
&:has(+ a:hover){ &:has(+ a:hover){
color: $rose; color: $rose;
} }
} }
a{ a{
font-size: 1.13em; font-size: 1.13em;
transition: color 0.15s ease-out;
&:hover{
color: $bleu_site;
}
} }
} }