antimatter.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. // Souligné horizontal sur titre block
  11. //
  12. //
  13. // var title = $(document).querySelectorAll("h1");
  14. // var start = (document).querySelectorAll(".after-h1");
  15. // // var finish = document.querySelectorAll(".after-h1-finish")
  16. // function isInView(event, visible) {
  17. // if title(visible == true) {
  18. // console.log("je te vois");
  19. // }
  20. // else {
  21. // console.log("je ne te vois pas");
  22. // }
  23. // };
  24. // var elements = document.getElementsByClass('souligne');
  25. //
  26. // elements.forEach(function(element) {
  27. // new WhenInViewport(element, function(elementInViewport) {
  28. // elementInViewport.classList.add('inViewport');
  29. // });
  30. // });
  31. //
  32. jQuery(document).ready(function($){
  33. //bouton "voir plus de ressources"
  34. // $("a.bouton-ouverture").removeAttr("href"); // On supprime le lien de notre bouton
  35. $('.bouton-ouverture').on('click', function(){ // lorsqu'on clique sur le bouton
  36. $('.texte-cache').toggleClass('ouvert'); // On ajoute ou retire la classe CSS "ouvert"
  37. if ($('.texte-cache').hasClass('ouvert')) { // Si le module texte a la classe "ouvert"
  38. $('.bouton-ouverture').html('Voir MOINS'); // On affiche LIRE MOINS sur le bouton
  39. } else {
  40. $('.bouton-ouverture').html('Voir PLUS'); // Sinon on affiche LIRE PLUS
  41. }
  42. });
  43. // parallax slideshow
  44. $(document).ready(function() {
  45. var imgSrc = ["http://ouidade.net/dev-epau.archi.fr/user/themes/epau-antimatter/images/14360_default_big.jpg", "http://ouidade.net/dev-epau.archi.fr/user/themes/epau-antimatter/images/10361_web_01.jpg", "http://ouidade.net/dev-epau.archi.fr/user/themes/epau-antimatter/images/hyperliens_marseille.png",];
  46. var counter = 1;
  47. var duration = 4000;
  48. var tTime = 300;
  49. var v = setInterval(function() {
  50. $('.parallax-mirror').animate({
  51. 'opacity': 0
  52. }, {
  53. duration: tTime,
  54. complete: function() {
  55. $(this).find('img').attr('src', imgSrc[counter]).end().animate({
  56. 'opacity': 1
  57. }, tTime);
  58. }
  59. });
  60. if (counter > imgSrc.length - 1) {
  61. counter = 0
  62. } else {
  63. counter++
  64. };
  65. },
  66. duration);
  67. });
  68. // // souligne apparait on scrollLock
  69. // $(function () {
  70. // var element = $("#triggerOnScroll");
  71. // $(window).scroll(function () {
  72. // if($(window).scrollTop() > 0) {
  73. // element.addClass("animateMe");
  74. // }
  75. //
  76. // });
  77. // jQuery('.your-class-here').one('inview', function (event, visible) {
  78. // if (visible == true) {
  79. // //Enjoy !
  80. // }
  81. // });
  82. // ON SCROLL EVENTS
  83. if (!isTouch){
  84. $(document).scroll(function() {
  85. scrollHeader();
  86. });
  87. };
  88. // TOUCH SCROLL
  89. $(document).on({
  90. 'touchmove': function(e) {
  91. scrollHeader(); // Replace this with your code.
  92. }
  93. });
  94. //Smooth scroll to top
  95. $('#toTop').click(function(){
  96. $("html, body").animate({ scrollTop: 0 }, 500);
  97. return false;
  98. });
  99. // Responsive Menu
  100. // POPIN Biographies
  101. $(".bouton").click(function(event){
  102. console.log(event);
  103. //
  104. var mods = document.querySelectorAll('.modal');
  105. mods.forEach((m, i) => {
  106. m.classList.remove('open')
  107. });
  108. //
  109. var btn = event.currentTarget;
  110. console.log('btn', btn);
  111. var mod = btn.parentNode.querySelector('.modal');
  112. mod.classList.add('open')
  113. });
  114. $(".modal .mask, .modal a.close").click(function(event){
  115. $ (".modal").removeClass("open");
  116. return false;
  117. });
  118. //
  119. // // Animate on scroll
  120. // $(function() {
  121. //
  122. // var $window = $(window),
  123. // win_height_padded = $window.height() * 1.1,
  124. // isTouch = Modernizr.touch;
  125. //
  126. // if (isTouch) { $('.after-h1').addClass('animated'); }
  127. //
  128. // $window.on('scroll', revealOnScroll);
  129. //
  130. // function revealOnScroll() {
  131. // var scrolled = $window.scrollTop(),
  132. // win_height_padded = $window.height() * 1.1;
  133. //
  134. // // Show...
  135. // $(".after-h1:not(.animated)").each(function () {
  136. // var $this = $(this),
  137. // offsetTop = $this.offset().top;
  138. //
  139. // if (scrolled + win_height_padded > offsetTop) {
  140. // if ($this.data('timeout')) {
  141. // window.setTimeout(function(){
  142. // $this.addClass('animated ' + $this.data('animation'));
  143. // }, parseInt($this.data('timeout'),10));
  144. // } else {
  145. // $this.addClass('animated ' + $this.data('animation'));
  146. // }
  147. // }
  148. // });
  149. // }
  150. //
  151. // revealOnScroll();
  152. // });
  153. });