123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- var isTouch = window.DocumentTouch && document instanceof DocumentTouch;
- function scrollHeader() {
-
- var zvalue = $(document).scrollTop();
- if ( zvalue > 75 )
- $("#header").addClass("scrolled");
- else
- $("#header").removeClass("scrolled");
- }
- jQuery(document).ready(function($){
-
- $('.bouton-ouverture').on('click', function(){
- $('.texte-cache').toggleClass('ouvert');
- if ($('.texte-cache').hasClass('ouvert')) {
- $('.bouton-ouverture').html('Voir MOINS');
- } else {
- $('.bouton-ouverture').html('Voir PLUS');
- }
- });
-
- if (!isTouch){
- $(document).scroll(function() {
- scrollHeader();
- });
- };
-
- $(document).on({
- 'touchmove': function(e) {
- scrollHeader();
- }
- });
-
- $('#toTop').click(function(){
- $("html, body").animate({ scrollTop: 0 }, 500);
- return false;
- });
-
-
- $(".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;
- });
-
- $(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;
-
- $(".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();
- });
- });
|