Capstone/ui/templates/script.templ

28 lines
794 B
Plaintext

package templates
templ toggleNavBar() {
<script>
function toggleNavbar(collapseID) {
document.getElementById(collapseID).classList.toggle("hidden");
document.getElementById(collapseID).classList.toggle("block");
}
</script>
}
templ toggleDropdown() {
<script src="https://unpkg.com/@popperjs/core@2.9.1/dist/umd/popper.min.js" charset="utf-8"></script>
<script>
function openDropdown(event,dropdownID){
let element = event.target;
while(element.nodeName !== "BUTTON"){
element = element.parentNode;
}
var popper = Popper.createPopper(element, document.getElementById(dropdownID), {
placement: 'bottom-start'
});
document.getElementById(dropdownID).classList.toggle("hidden");
document.getElementById(dropdownID).classList.toggle("block");
}
</script>
}