var Home = document.querySelector('.hero .slide');
if (Home != null) {
  var flkty = new Flickity( Home, {
    // options
    cellAlign: 'left',
    autoPlay: true,
    prevNextButtons: false
  });
}
var prive = document.querySelector('.prive .__slide');
if (prive != null) {
  var flkty = new Flickity( prive, {
    // options
    cellAlign: 'left',
    autoPlay: true,
  })
}

var slide_tpsF = document.querySelectorAll('.tpsF .slide');
if (slide_tpsF != null) {
  for (var i = 0; i < slide_tpsF.length; i++) {
    var flkty = new Flickity( slide_tpsF[i], {
      // options
      cellAlign: 'left',
      autoPlay: true,
      pageDots: false
    });
  }
}

var Partenaires = document.querySelector('.container_slide ul');
if (Partenaires != null) {
  var flkty = new Flickity( Partenaires, {
    cellAlign: 'left',
    pageDots: false
    // groupCells: true,
    // carousel-cell: true,
  });
 }

var arrayEnga = document.querySelector('.tableau_engagements.row');

if (arrayEnga != null) {
  var msnry = new Masonry(arrayEnga , {
    columnWidth: '.engagement',
    itemSelector: '.engagement',
    percentPosition: true
  });

}

var hamburgers = document.querySelector(".hamburger");
var nav = document.querySelector(".nav-main");
hamburgers.addEventListener("click", function() {
  this.classList.toggle("is-active");
  nav.classList.toggle("is-active");
});

var elem = document.querySelector('.grid');
if (elem != null) {
var iso = new Isotope( elem, {
  itemSelector: '.item',
  layoutMode: 'fitRows'
});

var filtersElem = document.querySelector('.filter-button-group');
filtersElem.addEventListener( 'click', function( event ) {
  var filterValue = event.target.getAttribute('data-filter');
  iso.arrange({ filter: filterValue });
});
}
