Multi-level navigation menus
added in v3
Serhii Moruk
I would like to be able to make animated multi-level navigation menus. This is very convenient for work when there are a large number of submenus.
For example, make it possible to add scripts and styles for the navigation menu in the administration, just as it is done in the article editor. An example that I use in articles to hide the content I need:
<style>
.links-list {
padding: 0!important;
max-height: 0;
transition: max-height .2s ease-out;
overflow: hidden
}
.toc-header {
margin-bottom: 1rem!important;
cursor: pointer
}
</style>
<script>
window.addEventListener("load", function() {
document.querySelectorAll('.toc-header').forEach(function(item) {
const accordion = item.parentElement.querySelector('.links-list');
item.addEventListener('click', function () {
if (accordion.style.maxHeight) {
accordion.style.maxHeight = '';
} else {
accordion.style.maxHeight = accordion.scrollHeight + "px";
}
})
})
})
</script>
Nicolas Giard
added in v3