liste etape scrollable if window too small
This commit is contained in:
parent
fc005904e2
commit
9049939b92
|
@ -32,9 +32,42 @@ export const useLayoutStore = defineStore('layout', {
|
||||||
animationToggle.classList.remove('hidden');
|
animationToggle.classList.remove('hidden');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
listeEtape.classList.remove('retracted');
|
listeEtape.classList.remove('retracted');
|
||||||
|
this.checkIfEtapeListeShouldScroll();
|
||||||
}, 300);
|
}, 300);
|
||||||
this.isEtapeListRetracted = false;
|
this.isEtapeListRetracted = false;
|
||||||
},
|
},
|
||||||
|
checkIfEtapeListeShouldScroll() {
|
||||||
|
const listeEtape = document.querySelector('#etapes-liste');
|
||||||
|
const column = document.querySelector('.layout__region--third');
|
||||||
|
|
||||||
|
const columnRect = column.getBoundingClientRect();
|
||||||
|
|
||||||
|
const listeEtapeContentRect = document.querySelector('#etapes-liste .item-list').getBoundingClientRect();
|
||||||
|
const headerRect = document.querySelector('.layout-container > header').getBoundingClientRect();
|
||||||
|
const animationToggleRect = document.querySelector('.animation-toggle-container').getBoundingClientRect();
|
||||||
|
|
||||||
|
const isIntersecting = headerRect.bottom >= (columnRect.height - listeEtapeContentRect.height) / 2;
|
||||||
|
|
||||||
|
if (isIntersecting) {
|
||||||
|
this.enableEtapeListeScroll(listeEtape, column, headerRect.height, animationToggleRect.top);
|
||||||
|
} else {
|
||||||
|
this.disableEtapeListeScroll(listeEtape, column);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
enableEtapeListeScroll(listeEtape, column, headerHeight, animationToggleTop) {
|
||||||
|
listeEtape.classList.add('scrollable');
|
||||||
|
column.classList.add('liste-etapes-scrollable');
|
||||||
|
|
||||||
|
listeEtape.style.marginTop = `${headerHeight}px`;
|
||||||
|
listeEtape.style.maxHeight = `calc(100vh - (100vh - ${animationToggleTop}px) - ${headerHeight}px)`;
|
||||||
|
},
|
||||||
|
disableEtapeListeScroll(listeEtape, column) {
|
||||||
|
listeEtape.classList.remove('scrollable');
|
||||||
|
column.classList.remove('liste-etapes-scrollable');
|
||||||
|
|
||||||
|
listeEtape.style.marginTop = 'unset';
|
||||||
|
listeEtape.style.maxHeight = 'unset';
|
||||||
|
},
|
||||||
setUpHamburgerToggle(menuBurger, menuContainer) {
|
setUpHamburgerToggle(menuBurger, menuContainer) {
|
||||||
const menuTitle = document.querySelector('#menu-title');
|
const menuTitle = document.querySelector('#menu-title');
|
||||||
const menuH2 = document.querySelector('#menu > h2');
|
const menuH2 = document.querySelector('#menu > h2');
|
||||||
|
|
|
@ -32,6 +32,11 @@ export function handleReactiveness() {
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
layoutStore.checkIfEtapeListeShouldScroll();
|
||||||
|
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
layoutStore.checkIfEtapeListeShouldScroll();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setMenuToggle() {
|
export function setMenuToggle() {
|
||||||
|
|
|
@ -567,6 +567,9 @@ body{
|
||||||
max-width: 25%;
|
max-width: 25%;
|
||||||
// grid-column: 16 / span 1;
|
// grid-column: 16 / span 1;
|
||||||
}
|
}
|
||||||
|
&.liste-etapes-scrollable {
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
@media screen and (min-width: $desktop-min-width) {
|
@media screen and (min-width: $desktop-min-width) {
|
||||||
background: linear-gradient(to right, transparent, #faf1eb);
|
background: linear-gradient(to right, transparent, #faf1eb);
|
||||||
grid-column: 11 / span 6;
|
grid-column: 11 / span 6;
|
||||||
|
@ -590,6 +593,20 @@ body{
|
||||||
&.disapeared {
|
&.disapeared {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
&.scrollable {
|
||||||
|
overflow-y: scroll;
|
||||||
|
mask-image: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
transparent 0%,
|
||||||
|
black 7%,
|
||||||
|
black 85%,
|
||||||
|
transparent 100%
|
||||||
|
);
|
||||||
|
ul {
|
||||||
|
// padding-top: 0.5rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
ul {
|
ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
> li {
|
> li {
|
||||||
|
@ -746,6 +763,13 @@ body{
|
||||||
transition: transform 0.3s ease-out;
|
transition: transform 0.3s ease-out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.transparent-gradient {
|
||||||
|
position:absolute;
|
||||||
|
z-index:2;
|
||||||
|
right:0; bottom:0; left:0;
|
||||||
|
height:200px;
|
||||||
|
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 70%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
> #content-modale {
|
> #content-modale {
|
||||||
padding-bottom: 20vh;
|
padding-bottom: 20vh;
|
||||||
|
@ -1247,10 +1271,10 @@ body{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
> #animation-toggle {
|
> #animation-toggle {
|
||||||
|
transition: opacity 0.3s ease-out;
|
||||||
@media screen and (min-width: $desktop-min-width) {
|
@media screen and (min-width: $desktop-min-width) {
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
}
|
}
|
||||||
transition: opacity 0.3s ease-out;
|
|
||||||
&.hidden {
|
&.hidden {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue