antimatter.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. var isTouch = window.DocumentTouch && document instanceof DocumentTouch;
  2. function scrollHeader() {
  3. // Has scrolled class on header
  4. var zvalue = $(document).scrollTop();
  5. if ( zvalue > 75 )
  6. $("#header").addClass("scrolled");
  7. else
  8. $("#header").removeClass("scrolled");
  9. }
  10. jQuery(document).ready(function($){
  11. //bouton "raison d'être (texte long epau)"
  12. // $("a.bouton-raisondetre").removeAttr("href"); // On supprime le lien de notre bouton
  13. $('.bouton-raisondetre').on('click', function(){ // lorsqu'on clique sur le bouton
  14. $('.texte-cache-raisondetre').toggleClass('ouvert'); // On ajoute ou retire la classe CSS "ouvert"
  15. if ($('.texte-cache-raisondetre').hasClass('ouvert')) { // Si le module texte a la classe "ouvert"
  16. $('.bouton-raisondetre').html('Voir MOINS'); // On affiche LIRE MOINS sur le bouton
  17. } else {
  18. $('.bouton-raisondetre').html("Lire plus"); // Sinon on affiche LIRE PLUS
  19. }
  20. // definir une règle si .texte-cache {max-height}<=.texte-cache.ouvert {max-height}, alors .bouton-ouverture { visible: hidden}
  21. });
  22. //bouton "voir plus de ressources"
  23. // $("a.bouton-ouverture").removeAttr("href"); // On supprime le lien de notre bouton
  24. $('.bouton-ouverture').on('click', function(){ // lorsqu'on clique sur le bouton
  25. $('.texte-cache').toggleClass('ouvert'); // On ajoute ou retire la classe CSS "ouvert"
  26. if ($('.texte-cache').hasClass('ouvert')) { // Si le module texte a la classe "ouvert"
  27. $('.bouton-ouverture').html('Voir MOINS'); // On affiche LIRE MOINS sur le bouton
  28. } else {
  29. $('.bouton-ouverture').html('Voir PLUS'); // Sinon on affiche LIRE PLUS
  30. }
  31. // definir une règle si .texte-cache {max-height}<=.texte-cache.ouvert {max-height}, alors .bouton-ouverture { visible: hidden}
  32. });
  33. // parallax slideshow
  34. $(document).ready(function() {
  35. var imgSrc = ["/user/themes/epau-antimatter/images/Thizy_Les_Bourgs_copyright_Communaute_de_l_Ouest_Rhodanien.jpg", "/user/themes/epau-antimatter/images/ARM161205-001.jpg", "/user/themes/epau-antimatter/images/copyright_Grenoble-Alpes_Metropole-Lucas_Frangella_1.jpg", "/user/themes/epau-antimatter/images/04_photo_ AE_PlanDAou_21.jpg", "/user/themes/epau-antimatter/images/Solideo_041120_Fauchon_Web_copyright_Sennse-cbadet_012.jpg", "/user/themes/epau-antimatter/images/04_photo_ AE_PlanDAou_36.jpg",];
  36. var counter = 1;
  37. var duration = 4000;
  38. var tTime = 0;
  39. var v = setInterval(function() {
  40. $('.parallax-mirror').animate({
  41. 'opacity': 0
  42. }, {
  43. duration: tTime,
  44. complete: function() {
  45. $(this).find('img').attr('src', imgSrc[counter]).end().animate({
  46. 'opacity': 1
  47. }, tTime);
  48. }
  49. });
  50. if (counter > imgSrc.length - 1) {
  51. counter = 0
  52. } else {
  53. counter++
  54. };
  55. },
  56. duration);
  57. });
  58. // ON SCROLL EVENTS
  59. if (!isTouch){
  60. $(document).scroll(function() {
  61. scrollHeader();
  62. });
  63. };
  64. // TOUCH SCROLL
  65. $(document).on({
  66. 'touchmove': function(e) {
  67. scrollHeader(); // Replace this with your code.
  68. }
  69. });
  70. //Smooth scroll to top
  71. $('#toTop').click(function(){
  72. $("html, body").animate({ scrollTop: 0 }, 500);
  73. return false;
  74. });
  75. // Responsive Menu
  76. // POPIN Biographies
  77. $(".bouton").click(function(event){
  78. console.log(event);
  79. //
  80. var mods = document.querySelectorAll('.modal');
  81. mods.forEach((m, i) => {
  82. m.classList.remove('open')
  83. });
  84. //
  85. var btn = event.currentTarget;
  86. console.log('btn', btn);
  87. var mod = btn.parentNode.querySelector('.modal');
  88. mod.classList.add('open')
  89. });
  90. $(".modal .mask, .modal a.close").click(function(event){
  91. $ (".modal").removeClass("open");
  92. return false;
  93. });
  94. // $('.programme').slick({
  95. // slidesToShow: 1,
  96. // // slidesToScroll: 1,
  97. // dots: true,
  98. // arrows: true,
  99. // centerMode: true,
  100. // // centerPadding: '100px',
  101. // responsive: [
  102. // {
  103. // breakpoint: 810,
  104. // settings: {
  105. // slidesToShow: 1,
  106. // adaptiveHeight: true,
  107. // arrows: false,
  108. // draggable: true,
  109. // centerMode: true,
  110. // }
  111. // }]
  112. // });
  113. // console.log('salut slick home');
  114. });
  115. // Animation souligné if inView
  116. function isScrolledIntoView(elem) {
  117. var docViewTop = $(window).scrollTop();
  118. var docViewBottom = docViewTop + $(window).height();
  119. var elemTop = $(elem).offset().top;
  120. var elemBottom = elemTop + $(elem).height();
  121. return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
  122. }
  123. $(window).scroll(function () {
  124. $('.souligne.toleft').each(function () {
  125. if (isScrolledIntoView(this) === true) {
  126. $(this).addClass('in-view')
  127. } else {
  128. $(this).removeClass('in-view')
  129. }
  130. });
  131. $('.souligne.toright').each(function () {
  132. if (isScrolledIntoView(this) === true) {
  133. $(this).addClass('in-view-right')
  134. } else {
  135. $(this).removeClass('in-view-right')
  136. }
  137. });
  138. });
  139. (function($, window) {
  140. console.log('hello')
  141. $(document).ready(function(){
  142. $('.programmes').slick({
  143. slidesToShow: 1,
  144. // slidesToScroll: 1,
  145. dots: true,
  146. arrows: true,
  147. centerMode: true,
  148. // centerPadding: '100px',
  149. responsive: [
  150. {
  151. breakpoint: 800,
  152. settings: {
  153. slidesToShow: 1,
  154. centerPadding: '0',
  155. // arrows: true,
  156. centerMode: true,
  157. swipeToSlide: true,
  158. }
  159. }]
  160. });
  161. console.log('salut slick home');
  162. });
  163. })(jQuery, window);