ajout du dropdown dans la page collectif

This commit is contained in:
Valentin
2024-06-12 22:25:21 +02:00
parent 66bd5cb3d9
commit 3b86f61152
4 changed files with 139 additions and 10 deletions
+22 -1
View File
@@ -13,6 +13,8 @@ $(document).ready( () => {
} else if ($('main').children(":first").attr('id') == 'reader') {
hideFooter()
displayReader()
} else if ($('main').children(":first").attr('id') == 'text-content') {
addToggleBiography()
}
initBarba()
})
@@ -69,7 +71,10 @@ function initBarba() {
loadProjetIndex()
filterWhenEntering()
} else if ($(data.next.container).attr('id') == 'text-content')
{ if (isDesktopDevice) { displayFooter() } }
{
if (isDesktopDevice) displayFooter()
addToggleBiography()
}
})
barba.hooks.after((data) => {
let pageTitleComparator, navIndex
@@ -813,3 +818,19 @@ function hideFooterOnResize() {
$('footer').css('display', 'none')
}
}
// dropdown collectif
function addToggleBiography() {
$('h4 + p > em, h4').on('click', toggleBiographie);
$('h4 + p > em').append('<img src="/user/themes/figureslibres-v2/images/pictos/chevron-down.svg" aria-hidden="true">');
}
function toggleBiographie(el) {
if (el.target.tagName === "H4") {
el.target.nextElementSibling.nextElementSibling.classList.toggle('open');
el.target.nextElementSibling.firstElementChild.firstElementChild.classList.toggle('open');
} else {
el.target.firstElementChild.classList.toggle('open');
el.target.parentElement.nextElementSibling.classList.toggle('open');
}
}