No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

menu.js 870B

1234567891011121314151617181920212223242526272829303132333435
  1. function menu_load() {
  2. const btn = document.querySelector('#h-menu');
  3. const nav = document.querySelector('#h-nav');
  4. btn.addEventListener('click', (e) => {
  5. nav.classList.toggle('open-menu')
  6. btn.classList.toggle('h-menu')
  7. e.preventDefault();
  8. });
  9. }
  10. function navilink(link) {
  11. window.location.href = link
  12. }
  13. if (window.addEventListener) {
  14. window.addEventListener('load', menu_load, false);
  15. } else {
  16. window.attachEvent("onload", menu_load);
  17. }
  18. document.addEventListener("DOMContentLoaded", () => {
  19. const title = document.querySelectorAll('.h-js-accordion-title');
  20. for (let i = 0; i < title.length; i++) {
  21. let titleEach = title[i];
  22. let content = titleEach.nextElementSibling;
  23. titleEach.addEventListener('click', () => {
  24. titleEach.classList.toggle('h-is-active');
  25. content.classList.toggle('h-is-open');
  26. });
  27. }
  28. });