diff --git a/Themes/default/scripts/script.js b/Themes/default/scripts/script.js index 40b2c2614eb..ed52dc913d0 100644 --- a/Themes/default/scripts/script.js +++ b/Themes/default/scripts/script.js @@ -1667,7 +1667,7 @@ function smc_resize(selector) { } document.addEventListener('DOMContentLoaded', () => { - const dropMenus = document.querySelectorAll('.buttonlist > .dropmenu'); + const dropMenus = document.querySelectorAll('.buttonlist li > .top_menu'); for (const item of dropMenus) { const prevElement = item.previousElementSibling; @@ -1675,19 +1675,16 @@ document.addEventListener('DOMContentLoaded', () => { e.stopPropagation(); e.preventDefault(); - if (window.getComputedStyle(item).display === 'block') { - item.style.display = 'none'; + if (item.classList.contains('visible')) { + item.classList.remove('visible') return true; } - item.style.display = 'block'; - item.style.top = (prevElement.offsetTop + prevElement.offsetHeight) + 'px'; - item.style.left = Math.max(prevElement.offsetLeft - item.offsetWidth + prevElement.offsetWidth, 0) + 'px'; - item.style.height = item.querySelector('div:first-child').offsetHeight + 'px'; + item.classList.add('visible'); }); document.addEventListener('click', () => { - item.style.display = 'none'; + item.classList.remove('visible'); }); }