main.js 777 B

1234567891011121314151617181920212223242526272829303132
  1. console.log('salut');
  2. // menu burger open
  3. var burger = document.getElementById("block-burger");
  4. var burgertitle = document.getElementById("block-burger-menu");
  5. burgertitle.addEventListener("click", toggleMenu);
  6. function toggleMenu(event) {
  7. console.log(event);
  8. burger.classList.toggle('opened');
  9. }
  10. // faq reponse open
  11. var answers = document.getElementsByClassName("field--name-field-reponse");
  12. var questions = document.getElementsByClassName("field--name-field-question");
  13. for (let i = 0; i < questions.length; i++) {
  14. const question = questions[i]
  15. question.addEventListener("click", toggleFaq);
  16. }
  17. function toggleFaq(event) {
  18. console.log(event);
  19. for (let i = 0; i < answers.length; i++) {
  20. const answer = answers[i]
  21. answer.classList.toggle('opened');}
  22. }