var isTouch = window.DocumentTouch && document instanceof DocumentTouch; function scrollHeader() { // Has scrolled class on header var zvalue = $(document).scrollTop(); if ( zvalue > 75 ) $("#header").addClass("scrolled"); else $("#header").removeClass("scrolled"); } // Souligné horizontal sur titre block // // // var title = $(document).querySelectorAll("h1"); // var start = (document).querySelectorAll(".after-h1"); // // var finish = document.querySelectorAll(".after-h1-finish") // function isInView(event, visible) { // if title(visible == true) { // console.log("je te vois"); // } // else { // console.log("je ne te vois pas"); // } // }; jQuery(document).ready(function($){ //bouton "voir plus de ressources" // $("a.bouton-ouverture").removeAttr("href"); // On supprime le lien de notre bouton $('.bouton-ouverture').on('click', function(){ // lorsqu'on clique sur le bouton $('.texte-cache').toggleClass('ouvert'); // On ajoute ou retire la classe CSS "ouvert" if ($('.texte-cache').hasClass('ouvert')) { // Si le module texte a la classe "ouvert" $('.bouton-ouverture').html('Voir MOINS'); // On affiche LIRE MOINS sur le bouton } else { $('.bouton-ouverture').html('Voir PLUS'); // Sinon on affiche LIRE PLUS } }); // jQuery('.your-class-here').one('inview', function (event, visible) { // if (visible == true) { // //Enjoy ! // } // }); // ON SCROLL EVENTS if (!isTouch){ $(document).scroll(function() { scrollHeader(); }); }; // TOUCH SCROLL $(document).on({ 'touchmove': function(e) { scrollHeader(); // Replace this with your code. } }); //Smooth scroll to top $('#toTop').click(function(){ $("html, body").animate({ scrollTop: 0 }, 500); return false; }); // Responsive Menu // POPIN Biographies $(".bouton").click(function(event){ console.log(event); // var mods = document.querySelectorAll('.modal'); mods.forEach((m, i) => { m.classList.remove('open') }); // var btn = event.currentTarget; console.log('btn', btn); var mod = btn.parentNode.querySelector('.modal'); mod.classList.add('open') }); $(".modal .mask, .modal a.close").click(function(event){ $ (".modal").removeClass("open"); return false; }); // Animate on scroll $(function() { var $window = $(window), win_height_padded = $window.height() * 1.1, isTouch = Modernizr.touch; if (isTouch) { $('.after-h1').addClass('animated'); } $window.on('scroll', revealOnScroll); function revealOnScroll() { var scrolled = $window.scrollTop(), win_height_padded = $window.height() * 1.1; // Show... $(".after-h1:not(.animated)").each(function () { var $this = $(this), offsetTop = $this.offset().top; if (scrolled + win_height_padded > offsetTop) { if ($this.data('timeout')) { window.setTimeout(function(){ $this.addClass('animated ' + $this.data('animation')); }, parseInt($this.data('timeout'),10)); } else { $this.addClass('animated ' + $this.data('animation')); } } }); } revealOnScroll(); }); });