menu_handler.js 803 B

123456789101112131415161718192021222324252627
  1. class MenuHandler {
  2. clickMenuListItem(event) {
  3. let element = event.target;
  4. if (element.tagName === "A") {
  5. window.location.href = element.getAttribute("href");
  6. } else {
  7. window.location.href = element.querySelector("a").getAttribute("href");
  8. }
  9. }
  10. toggleMainMenu() {
  11. let menu = document.querySelector(".header nav ul");
  12. if (DomHelper.isVisible(menu)) {
  13. menu.style.display = "none";
  14. } else {
  15. menu.style.display = "block";
  16. }
  17. let searchElement = document.querySelector(".header .search");
  18. if (DomHelper.isVisible(searchElement)) {
  19. searchElement.style.display = "none";
  20. } else {
  21. searchElement.style.display = "block";
  22. }
  23. }
  24. }