mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-25 02:19:12 -04:00
adjusted subnav to hover
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
(function(window) {
|
||||
"use strict";
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const sideNavLinks = document.querySelectorAll('.usa-sidenav__item');
|
||||
const currentURL = window.location.pathname;
|
||||
|
||||
sideNavLinks.forEach(link => {
|
||||
const sublist = link.querySelector('.usa-sidenav__sublist');
|
||||
const parentLink = link.querySelector('a');
|
||||
|
||||
const isMatch = parentLink && sublist && currentURL === parentLink.getAttribute('href');
|
||||
if (isMatch) {
|
||||
sublist.classList.replace('display-none', 'display-block');
|
||||
}
|
||||
|
||||
link.addEventListener('click', function(event) {
|
||||
if (sublist && event.target === parentLink) {
|
||||
event.preventDefault();
|
||||
|
||||
sublist.classList.toggle('display-none');
|
||||
sublist.classList.toggle('display-block');
|
||||
|
||||
setTimeout(() => window.location.href = parentLink.href, 50);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})(window);
|
||||
Reference in New Issue
Block a user