amélioration dropdown collectif et debug (?) la nav au resize
This commit is contained in:
@@ -77,6 +77,7 @@ function initBarba() {
|
||||
}
|
||||
})
|
||||
barba.hooks.after((data) => {
|
||||
refreshUiOnResize()
|
||||
let pageTitleComparator, navIndex
|
||||
switch ($('main').children(":first").attr('id')) {
|
||||
case 'index-content':
|
||||
@@ -175,9 +176,11 @@ function refreshUiOnResize() {
|
||||
if (result) {
|
||||
currentColor = $('body').css('background-color')
|
||||
if (isDesktopDevice) {
|
||||
console.log("is desktop");
|
||||
$('nav').css('background-color', currentColor)
|
||||
$('#nav-container').css('background-color', color_bg)
|
||||
} else {
|
||||
console.log("is NOT desktop");
|
||||
$('nav').css('background-color', color_main)
|
||||
$('#nav-container').css('background-color', currentColor)
|
||||
}
|
||||
@@ -826,11 +829,20 @@ function addToggleBiography() {
|
||||
}
|
||||
|
||||
function toggleBiographie(el) {
|
||||
let targetContent;
|
||||
let targetArrow;
|
||||
if (el.target.tagName === "H4") {
|
||||
el.target.nextElementSibling.nextElementSibling.classList.toggle('open');
|
||||
el.target.nextElementSibling.firstElementChild.firstElementChild.classList.toggle('open');
|
||||
targetContent = el.target.nextElementSibling.nextElementSibling;
|
||||
targetArrow = el.target.nextElementSibling.firstElementChild.firstElementChild;
|
||||
} else {
|
||||
el.target.firstElementChild.classList.toggle('open');
|
||||
el.target.parentElement.nextElementSibling.classList.toggle('open');
|
||||
targetContent = el.target.firstElementChild;
|
||||
targetArrow = el.target.parentElement.nextElementSibling;
|
||||
}
|
||||
for (let openElement of document.querySelectorAll('h4 + p > em > img, h4 + p + p')) {
|
||||
if (openElement !== targetContent && openElement !== targetArrow) {
|
||||
openElement.classList.remove('open');
|
||||
}
|
||||
}
|
||||
targetContent.classList.toggle('open');
|
||||
targetArrow.classList.toggle('open');
|
||||
}
|
||||
Reference in New Issue
Block a user