1// window.addEventListener("resize", function() {
2// "use strict"; window.location.reload();
6 document.addEventListener("DOMContentLoaded", function(){
9 /////// Prevent closing from click inside dropdown
10 document.querySelectorAll('.dropdown-menu').forEach(function(element){
11 element.addEventListener('click', function (e) {
18 // make it as accordion for smaller screens
19 if (window.innerWidth < 992) {
21 // close all inner dropdowns when parent is closed
22 document.querySelectorAll('.navbar .dropdown').forEach(function(everydropdown){
23 everydropdown.addEventListener('hidden.bs.dropdown', function () {
24 // after dropdown is hidden, then find all submenus
25 this.querySelectorAll('.submenu').forEach(function(everysubmenu){
26 // hide every submenu as well
27 everysubmenu.style.display = 'none';
32 document.querySelectorAll('.dropdown-menu a').forEach(function(element){
33 element.addEventListener('click', function (e) {
35 let nextEl = this.nextElementSibling;
36 if(nextEl && nextEl.classList.contains('submenu')) {
37 // prevent opening link if link needs to open dropdown
40 if(nextEl.style.display == 'block'){
41 nextEl.style.display = 'none';
43 nextEl.style.display = 'block';
53 // DOMContentLoaded end