flip-flop partie cards

This commit is contained in:
2026-02-02 11:55:45 +01:00
parent 38e2390f12
commit 31f40e9578
5 changed files with 84 additions and 23 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -43,8 +43,9 @@ gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
function init () { function init () {
console.log('MathalloTheme init()') console.log('MathalloTheme init()')
initBurgerMenu(); initBurgerMenu();
initPartieFrontBackCardSwitch();
initBgAnime() initBgAnime()
initVues() // initVues()
} }
function initBurgerMenu() { function initBurgerMenu() {
@@ -56,6 +57,23 @@ gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
}) })
} }
function initPartieFrontBackCardSwitch() {
let principes_pratique = document.getElementById('partie-principes-pratique');
let cards = principes_pratique.getElementsByClassName('field-card');
console.log('cards', cards);
for (const card of cards) {
card.addEventListener('mousemove', function (e) {
console.log(this, e);
for (const child of this.parentElement.children){
child.classList.add('back-card')
child.classList.remove('front-card');
}
this.classList.add('front-card')
this.classList.remove('back-card')
})
}
}
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
@@ -70,19 +88,19 @@ gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
// }); // });
} }
function initVues(){ // function initVues(){
console.log('initVues'); // console.log('initVues');
// initVueContent(); // // initVueContent();
} // }
function initVueContent(){ // function initVueContent(){
createApp(Content).mount('main[role="main"]'); // createApp(Content).mount('main[role="main"]');
// processEtapeLinks(); // // processEtapeLinks();
} // }
// function onClickEtapeLink(e){ // function onClickEtapeLink(e){

View File

@@ -294,12 +294,15 @@ main[role="main"]{
article.node-type-chapitre{ article.node-type-chapitre{
} }
// Page Chapitres
section.parties{ section.parties{
display: flex; display: flex;
gap: 2em; gap: 2em;
padding:1em; padding:1em;
} }
// Page Partie
section.field-card{ section.field-card{
@include card; @include card;
@@ -351,6 +354,41 @@ main[role="main"]{
} }
} }
} }
div#partie-principes-pratique{
position: relative;
display: flex;
gap: 0px;
section.field-card{
@mixin front-card{
z-index: 2;
background-color: #fff;
}
@mixin back-card{
z-index: 1;
background-color: #eee;
}
&.field-principes-reflexion{
@include front-card();
}
&.field-en-pratique{
margin-left: -50%;
margin-top: 7em;
@include back-card();
}
&.field-principes-reflexion,
&.field-en-pratique{
transition: background-color 0.25s ease-out;
&.back-card{
@include back-card();
}
&.front-card{
@include front-card();
}
}
}
}
// HOME // HOME
div.views-home-chapitres{ div.views-home-chapitres{

View File

@@ -80,12 +80,17 @@
</div> </div>
</article> </article>
{% if content.field_principes_reflexions %}
<section class="field-card field-principes-reflexion">{{ content.field_principes_reflexions }}</section>
{% endif %}
{% if content.field_en_pratique %} {% if content.field_principes_reflexions or content.field_en_pratique %}
<section class="field-card field-en-pratique">{{ content.field_en_pratique }}</section> <div id="partie-principes-pratique">
{% if content.field_principes_reflexions %}
<section class="field-card field-principes-reflexion">{{ content.field_principes_reflexions }}</section>
{% endif %}
{% if content.field_en_pratique %}
<section class="field-card field-en-pratique">{{ content.field_en_pratique }}</section>
{% endif %}
</div>
{% endif %} {% endif %}
{% if content.field_ressources %} {% if content.field_ressources %}