mirror of
https://github.com/ae-utbm/sith.git
synced 2025-06-12 14:15:20 +00:00
Remove js size animation and only use the opacity one
This commit is contained in:
parent
4774a7b741
commit
36d4a02a45
@ -1,33 +0,0 @@
|
||||
const updateMaxHeight = (element: HTMLDetailsElement) => {
|
||||
const content = element.querySelector(".accordion-content") as HTMLElement | null;
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
if (element.hasAttribute("open")) {
|
||||
content.style.maxHeight = `${content.scrollHeight}px`;
|
||||
} else {
|
||||
content.style.maxHeight = "0px";
|
||||
}
|
||||
};
|
||||
|
||||
// Initialize max-height at load
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
for (const el of document.querySelectorAll("details.accordion")) {
|
||||
updateMaxHeight(el as HTMLDetailsElement);
|
||||
}
|
||||
});
|
||||
|
||||
// Accordion opened
|
||||
new MutationObserver((mutations: MutationRecord[]) => {
|
||||
for (const mutation of mutations) {
|
||||
const target = mutation.target as HTMLDetailsElement;
|
||||
if (target.tagName !== "DETAILS" || !target.classList.contains("accordion")) {
|
||||
continue;
|
||||
}
|
||||
updateMaxHeight(target);
|
||||
}
|
||||
}).observe(document.body, {
|
||||
attributes: true,
|
||||
attributeFilter: ["open"],
|
||||
subtree: true,
|
||||
});
|
@ -27,7 +27,6 @@
|
||||
<script type="module" src="{{ static('bundled/htmx-index.js') }}"></script>
|
||||
<script type="module" src="{{ static('bundled/country-flags-index.ts') }}"></script>
|
||||
<script type="module" src="{{ static('bundled/core/tooltips-index.ts') }}"></script>
|
||||
<script type="module" src="{{ static('bundled/core/accordion-index.ts') }}"></script>
|
||||
|
||||
<!-- Jquery declared here to be accessible in every django widgets -->
|
||||
<script src="{{ static('bundled/vendored/jquery.min.js') }}"></script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user