CRSSWebsite/js/main.js

24 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2024-06-09 13:47:59 +00:00
const $ = _ => document.querySelector(_);
const $$ = _ => document.querySelectorAll(_);
2024-06-09 13:47:59 +00:00
const dropDowns = $$('.dropDown');
2024-06-09 13:47:59 +00:00
dropDowns.forEach(dropDown => {
dropDown.children[0].addEventListener('click', () => {
dropDown.classList.toggle('open');
});
});
2024-06-09 13:47:59 +00:00
// ------------ //
2024-01-11 19:38:35 +00:00
2024-06-09 13:47:59 +00:00
const navBar = $('.navBar');
const navToggle = $('.navToggle');
const navCollapse = $('.navCollapse');
navToggle.addEventListener('click', () => {
navBar.classList.toggle('navOpen');
navToggle.innerHTML = navBar.classList.contains('navOpen') ?
'<svg xmlns="http://www.w3.org/2000/svg" class="lucide lucide-x icon" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>' :
'<svg xmlns="http://www.w3.org/2000/svg" class="lucide lucide-menu icon" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" x2="20" y1="12" y2="12"></line><line x1="4" x2="20" y1="6" y2="6"></line><line x1="4" x2="20" y1="18" y2="18"></line></svg>';
});