2020-05-27 16:19:38 +02:00
|
|
|
function toggleClass(ids, option) {
|
|
|
|
ids.forEach(id => {
|
|
|
|
var element = document.getElementById(id);
|
2020-05-27 18:20:36 +02:00
|
|
|
var className = element.getAttribute("class").replace(/ .*/, '');
|
2020-05-27 16:19:38 +02:00
|
|
|
if (id === option) {
|
|
|
|
element.classList.replace(className, "selected");
|
|
|
|
} else {
|
|
|
|
element.classList.replace(className, "not-selected");
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function navbarCollapse() {
|
|
|
|
var element = document.getElementById('nav');
|
|
|
|
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
|
|
|
|
element.classList.add("navbar-shrink");
|
|
|
|
element.classList.add("fixed-top");
|
|
|
|
} else {
|
|
|
|
element.classList.remove("navbar-shrink");
|
|
|
|
element.classList.remove("fixed-top");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
navbarCollapse();
|
2020-05-27 18:20:36 +02:00
|
|
|
window.onscroll = function () { navbarCollapse() };
|
|
|
|
|
|
|
|
function dropdownToggle(dropdownId) {
|
|
|
|
this.closeOpenDropdowns();
|
|
|
|
document.getElementById(dropdownId).classList.toggle("show");
|
|
|
|
}
|
|
|
|
|
|
|
|
function closeOpenDropdowns() {
|
|
|
|
var dropdowns = document.getElementsByClassName("dropdown-content");
|
|
|
|
var i;
|
|
|
|
for (i = 0; i < dropdowns.length; i++) {
|
|
|
|
var openDropdown = dropdowns[i];
|
|
|
|
if (openDropdown.classList.contains('show')) {
|
|
|
|
openDropdown.classList.remove('show');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close the dropdown if the user clicks outside of it
|
|
|
|
window.onclick = function (event) {
|
|
|
|
if (!event.target.matches('.dropbtn')) {
|
|
|
|
this.closeOpenDropdowns();
|
|
|
|
}
|
|
|
|
}
|