main.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. // Attention ouvre toutes les question en même temps
  12. var answers = document.getElementsByClassName("field--name-field-reponse");
  13. var questions = document.getElementsByClassName("field--name-field-question");
  14. for (let i = 0; i < questions.length; i++) {
  15. const question = questions[i]
  16. question.addEventListener("click", toggleFaq);
  17. }
  18. function toggleFaq(event) {
  19. question.nextElementSibling.classList.toggle('opened');
  20. }
  21. // function toggleFaq(event) {
  22. // console.log(event);
  23. // for (let i = 0; i < answers.length; i++) {
  24. // const answer = answers[i]
  25. // answer.classList.toggle('opened');}
  26. // }
  27. // /////////////////
  28. // document.addEventListener('click', function(e) {
  29. // if (e.target.classList.contains('rect_white_left') {
  30. // e.target.parentNode.nextElementSibling...
  31. // }
  32. // });
  33. ///////////////////
  34. // document.addEventListener('click', function(e) {
  35. // if (e.target.classList.contains('rect_white_left') {
  36. // e.target.parentNode.nextElementSibling.classList.toggle('opened');}
  37. // }
  38. // fonction pour attribuer la class du parents
  39. // var fields = document.getElementsByClassName("field--name-field-titre");
  40. // var paragraphs = document.getElementsByClassName("paragraph--type--texte");
  41. // for (let i = 0; i < fields.length; i++) {
  42. // const field = fields[i]
  43. // }
  44. // function giveIdParent(){
  45. // document.field.classList="paragraphs";
  46. // }
  47. // Function mouseOut ()
  48. // {
  49. // document.getelementbyid("flashdiv").classname="flash-I";
  50. // }
  51. // open external link in new window
  52. // $(".ext").each(
  53. // function(i,e){
  54. // window.open(e, '_blank');
  55. // }
  56. // );
  57. // var target = document.getElementsByClassName("ext");
  58. // document.addEventListener("click", function(e) {
  59. // if (e.target == true )
  60. // {
  61. // e.target.setAttribute("target", "_blank");
  62. // }
  63. // });
  64. // add id to field
  65. // Add data-extlink attribute.
  66. // $links_to_process.attr('data-extlink', '');
  67. // var i;
  68. // var length = $links_to_process.length;
  69. // for (i = 0; i < length; i++) {
  70. // var $link = $($links_to_process[i]);
  71. // if (drupalSettings.data.extlink.extUseFontAwesome) {
  72. // if (class_name === drupalSettings.data.extlink.mailtoClass) {
  73. // $link[icon_placement]('<span class="fa-' + class_name + ' extlink"><span class="' + drupalSettings.data.extlink.extFaMailtoClasses + '" aria-label="' + drupalSettings.data.extlink.mailtoLabel + '"></span></span>');
  74. // }
  75. // else {
  76. // $link[icon_placement]('<span class="fa-' + class_name + ' extlink"><span class="' + drupalSettings.data.extlink.extFaLinkClasses + '" aria-label="' + drupalSettings.data.extlink.extLabel + '"></span></span>');
  77. // }
  78. // }
  79. // else {
  80. // if (class_name === drupalSettings.data.extlink.mailtoClass) {
  81. // $link[icon_placement]('<svg focusable="false" class="' + class_name + '" role="img" aria-label="' + drupalSettings.data.extlink.mailtoLabel + '" xmlns="http://www.w3.org/2000/svg" viewBox="0 10 70 20"><metadata><sfw xmlns="http://ns.adobe.com/SaveForWeb/1.0/"><sliceSourceBounds y="-8160" x="-8165" width="16389" height="16384" bottomLeftOrigin="true"/><optimizationSettings><targetSettings targetSettingsID="0" fileFormat="PNG24Format"><PNG24Format transparency="true" filtered="false" interlaced="false" noMatteColor="false" matteColor="#FFFFFF"/></targetSettings></optimizationSettings></sfw></metadata><title>' + drupalSettings.data.extlink.mailtoLabel + '</title><path d="M56 14H8c-1.1 0-2 0.9-2 2v32c0 1.1 0.9 2 2 2h48c1.1 0 2-0.9 2-2V16C58 14.9 57.1 14 56 14zM50.5 18L32 33.4 13.5 18H50.5zM10 46V20.3l20.7 17.3C31.1 37.8 31.5 38 32 38s0.9-0.2 1.3-0.5L54 20.3V46H10z"/></svg>');
  82. // }
  83. // else {
  84. // $link[icon_placement]('<svg focusable="false" class="' + class_name + '" role="img" aria-label="' + drupalSettings.data.extlink.extLabel + '" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 40"><metadata><sfw xmlns="http://ns.adobe.com/SaveForWeb/1.0/"><sliceSourceBounds y="-8160" x="-8165" width="16389" height="16384" bottomLeftOrigin="true"/><optimizationSettings><targetSettings targetSettingsID="0" fileFormat="PNG24Format"><PNG24Format transparency="true" filtered="false" interlaced="false" noMatteColor="false" matteColor="#FFFFFF"/></targetSettings></optimizationSettings></sfw></metadata><title>' + drupalSettings.data.extlink.extLabel + '</title><path d="M48 26c-1.1 0-2 0.9-2 2v26H10V18h26c1.1 0 2-0.9 2-2s-0.9-2-2-2H8c-1.1 0-2 0.9-2 2v40c0 1.1 0.9 2 2 2h40c1.1 0 2-0.9 2-2V28C50 26.9 49.1 26 48 26z"/><path d="M56 6H44c-1.1 0-2 0.9-2 2s0.9 2 2 2h7.2L30.6 30.6c-0.8 0.8-0.8 2 0 2.8C31 33.8 31.5 34 32 34s1-0.2 1.4-0.6L54 12.8V20c0 1.1 0.9 2 2 2s2-0.9 2-2V8C58 6.9 57.1 6 56 6z"/></svg>');
  85. // }
  86. // }
  87. // }
  88. // };