antimatter.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. jQuery(document).ready(function($){
  25. //bouton "voir plus de ressources"
  26. // $("a.bouton-ouverture").removeAttr("href"); // On supprime le lien de notre bouton
  27. $('.bouton-ouverture').on('click', function(){ // lorsqu'on clique sur le bouton
  28. $('.texte-cache').toggleClass('ouvert'); // On ajoute ou retire la classe CSS "ouvert"
  29. if ($('.texte-cache').hasClass('ouvert')) { // Si le module texte a la classe "ouvert"
  30. $('.bouton-ouverture').html('Voir MOINS'); // On affiche LIRE MOINS sur le bouton
  31. } else {
  32. $('.bouton-ouverture').html('Voir PLUS'); // Sinon on affiche LIRE PLUS
  33. }
  34. });
  35. // jQuery('.your-class-here').one('inview', function (event, visible) {
  36. // if (visible == true) {
  37. // //Enjoy !
  38. // }
  39. // });
  40. // ON SCROLL EVENTS
  41. if (!isTouch){
  42. $(document).scroll(function() {
  43. scrollHeader();
  44. });
  45. };
  46. // TOUCH SCROLL
  47. $(document).on({
  48. 'touchmove': function(e) {
  49. scrollHeader(); // Replace this with your code.
  50. }
  51. });
  52. //Smooth scroll to top
  53. $('#toTop').click(function(){
  54. $("html, body").animate({ scrollTop: 0 }, 500);
  55. return false;
  56. });
  57. // Responsive Menu
  58. // POPIN Biographies
  59. $(".bouton").click(function(event){
  60. console.log(event);
  61. //
  62. var mods = document.querySelectorAll('.modal');
  63. mods.forEach((m, i) => {
  64. m.classList.remove('open')
  65. });
  66. //
  67. var btn = event.currentTarget;
  68. console.log('btn', btn);
  69. var mod = btn.parentNode.querySelector('.modal');
  70. mod.classList.add('open')
  71. });
  72. $(".modal .mask, .modal a.close").click(function(event){
  73. $ (".modal").removeClass("open");
  74. return false;
  75. });
  76. // Animate on scroll
  77. $(function() {
  78. var $window = $(window),
  79. win_height_padded = $window.height() * 1.1,
  80. isTouch = Modernizr.touch;
  81. if (isTouch) { $('.after-h1').addClass('animated'); }
  82. $window.on('scroll', revealOnScroll);
  83. function revealOnScroll() {
  84. var scrolled = $window.scrollTop(),
  85. win_height_padded = $window.height() * 1.1;
  86. // Show...
  87. $(".after-h1:not(.animated)").each(function () {
  88. var $this = $(this),
  89. offsetTop = $this.offset().top;
  90. if (scrolled + win_height_padded > offsetTop) {
  91. if ($this.data('timeout')) {
  92. window.setTimeout(function(){
  93. $this.addClass('animated ' + $this.data('animation'));
  94. }, parseInt($this.data('timeout'),10));
  95. } else {
  96. $this.addClass('animated ' + $this.data('animation'));
  97. }
  98. }
  99. });
  100. }
  101. revealOnScroll();
  102. });
  103. });