antimatter.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. // jQuery('.your-class-here').one('inview', function (event, visible) {
  26. // if (visible == true) {
  27. // //Enjoy !
  28. // }
  29. // });
  30. // ON SCROLL EVENTS
  31. if (!isTouch){
  32. $(document).scroll(function() {
  33. scrollHeader();
  34. });
  35. };
  36. // TOUCH SCROLL
  37. $(document).on({
  38. 'touchmove': function(e) {
  39. scrollHeader(); // Replace this with your code.
  40. }
  41. });
  42. //Smooth scroll to top
  43. $('#toTop').click(function(){
  44. $("html, body").animate({ scrollTop: 0 }, 500);
  45. return false;
  46. });
  47. // Responsive Menu
  48. // POPIN Biographies
  49. $(".bouton").click(function(event){
  50. console.log(event);
  51. //
  52. var mods = document.querySelectorAll('.modal');
  53. mods.forEach((m, i) => {
  54. m.classList.remove('open')
  55. });
  56. //
  57. var btn = event.currentTarget;
  58. console.log('btn', btn);
  59. var mod = btn.parentNode.querySelector('.modal');
  60. mod.classList.add('open')
  61. });
  62. $(".modal .mask, .modal a.close").click(function(event){
  63. $ (".modal").removeClass("open");
  64. return false;
  65. });
  66. // Animate on scroll
  67. $(function() {
  68. var $window = $(window),
  69. win_height_padded = $window.height() * 1.1,
  70. isTouch = Modernizr.touch;
  71. if (isTouch) { $('.after-h1').addClass('animated'); }
  72. $window.on('scroll', revealOnScroll);
  73. function revealOnScroll() {
  74. var scrolled = $window.scrollTop(),
  75. win_height_padded = $window.height() * 1.1;
  76. // Show...
  77. $(".after-h1:not(.animated)").each(function () {
  78. var $this = $(this),
  79. offsetTop = $this.offset().top;
  80. if (scrolled + win_height_padded > offsetTop) {
  81. if ($this.data('timeout')) {
  82. window.setTimeout(function(){
  83. $this.addClass('animated ' + $this.data('animation'));
  84. }, parseInt($this.data('timeout'),10));
  85. } else {
  86. $this.addClass('animated ' + $this.data('animation'));
  87. }
  88. }
  89. });
  90. }
  91. revealOnScroll();
  92. });
  93. });