antimatter.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 "voir plus de ressources"
  12. // $("a.bouton-ouverture").removeAttr("href"); // On supprime le lien de notre bouton
  13. $('.bouton-ouverture').on('click', function(){ // lorsqu'on clique sur le bouton
  14. $('.texte-cache').toggleClass('ouvert'); // On ajoute ou retire la classe CSS "ouvert"
  15. if ($('.texte-cache').hasClass('ouvert')) { // Si le module texte a la classe "ouvert"
  16. $('.bouton-ouverture').html('Voir MOINS'); // On affiche LIRE MOINS sur le bouton
  17. } else {
  18. $('.bouton-ouverture').html('Voir PLUS'); // Sinon on affiche LIRE PLUS
  19. }
  20. });
  21. // parallax slideshow
  22. $(document).ready(function() {
  23. 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",];
  24. var counter = 1;
  25. var duration = 4000;
  26. var tTime = 300;
  27. var v = setInterval(function() {
  28. $('.parallax-mirror').animate({
  29. 'opacity': 0
  30. }, {
  31. duration: tTime,
  32. complete: function() {
  33. $(this).find('img').attr('src', imgSrc[counter]).end().animate({
  34. 'opacity': 1
  35. }, tTime);
  36. }
  37. });
  38. if (counter > imgSrc.length - 1) {
  39. counter = 0
  40. } else {
  41. counter++
  42. };
  43. },
  44. duration);
  45. });
  46. // ON SCROLL EVENTS
  47. if (!isTouch){
  48. $(document).scroll(function() {
  49. scrollHeader();
  50. });
  51. };
  52. // TOUCH SCROLL
  53. $(document).on({
  54. 'touchmove': function(e) {
  55. scrollHeader(); // Replace this with your code.
  56. }
  57. });
  58. //Smooth scroll to top
  59. $('#toTop').click(function(){
  60. $("html, body").animate({ scrollTop: 0 }, 500);
  61. return false;
  62. });
  63. // Responsive Menu
  64. // POPIN Biographies
  65. $(".bouton").click(function(event){
  66. console.log(event);
  67. //
  68. var mods = document.querySelectorAll('.modal');
  69. mods.forEach((m, i) => {
  70. m.classList.remove('open')
  71. });
  72. //
  73. var btn = event.currentTarget;
  74. console.log('btn', btn);
  75. var mod = btn.parentNode.querySelector('.modal');
  76. mod.classList.add('open')
  77. });
  78. $(".modal .mask, .modal a.close").click(function(event){
  79. $ (".modal").removeClass("open");
  80. return false;
  81. });
  82. });
  83. // Animation souligné if inView
  84. function isScrolledIntoView(elem) {
  85. var docViewTop = $(window).scrollTop();
  86. var docViewBottom = docViewTop + $(window).height();
  87. var elemTop = $(elem).offset().top;
  88. var elemBottom = elemTop + $(elem).height();
  89. return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
  90. }
  91. $(window).scroll(function () {
  92. $('.souligne.toleft').each(function () {
  93. if (isScrolledIntoView(this) === true) {
  94. $(this).addClass('in-view')
  95. } else {
  96. $(this).removeClass('in-view')
  97. }
  98. });
  99. $('.souligne.toright').each(function () {
  100. if (isScrolledIntoView(this) === true) {
  101. $(this).addClass('in-view-right')
  102. } else {
  103. $(this).removeClass('in-view-right')
  104. }
  105. });
  106. });