This commit is contained in:
flaskfarm
2022-10-28 06:09:16 +09:00
parent dbe4d852b2
commit 6e7b7709b3
7 changed files with 192 additions and 58 deletions

View File

@@ -102,3 +102,7 @@ background-color: #ffff0080 !important;
margin-left:0.7rem; margin-right:0.7rem; margin-bottom: .5rem;
}
}
.dropdown-menu {
margin:-2px;
}

View File

@@ -97,52 +97,3 @@ function m_tab_content(name, content, active) {
return str;
}
document.addEventListener("DOMContentLoaded", function(){
/////// Prevent closing from click inside dropdown
document.querySelectorAll('.dropdown-menu').forEach(function(element){
element.addEventListener('click', function (e) {
e.stopPropagation();
});
})
// make it as accordion for smaller screens
if (window.innerWidth < 992) {
// close all inner dropdowns when parent is closed
document.querySelectorAll('.navbar .dropdown').forEach(function(everydropdown){
everydropdown.addEventListener('hidden.bs.dropdown', function () {
// after dropdown is hidden, then find all submenus
this.querySelectorAll('.submenu').forEach(function(everysubmenu){
// hide every submenu as well
everysubmenu.style.display = 'none';
});
})
});
document.querySelectorAll('.dropdown-menu a').forEach(function(element){
element.addEventListener('click', function (e) {
let nextEl = this.nextElementSibling;
if(nextEl && nextEl.classList.contains('submenu')) {
// prevent opening link if link needs to open dropdown
e.preventDefault();
console.log(nextEl);
if(nextEl.style.display == 'block'){
nextEl.style.display = 'none';
} else {
nextEl.style.display = 'block';
}
}
});
})
}
// end if innerWidth
});
// DOMContentLoaded end

View File

@@ -1 +1 @@
VERSION="4.0.44"
VERSION="4.0.45"