149 lines
4.0 KiB
JavaScript
149 lines
4.0 KiB
JavaScript
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");
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
}
|
|
|
|
|
|
// definir une règle si .texte-cache {max-height}<=.texte-cache.ouvert {max-height}, alors .bouton-ouverture { visible: hidden}
|
|
|
|
});
|
|
|
|
|
|
// parallax slideshow
|
|
$(document).ready(function() {
|
|
var imgSrc = ["/user/themes/epau-antimatter/images/Thizy_Les_Bourgs_copyright_Communaute_de_l_Ouest_Rhodanien.jpg", "/user/themes/epau-antimatter/images/ARM161205-001.jpg", "/user/themes/epau-antimatter/images/copyright_Grenoble-Alpes_Metropole-Lucas_Frangella_1.jpg", "/user/themes/epau-antimatter/images/04_photo_ AE_PlanDAou_21.jpg", "/user/themes/epau-antimatter/images/Solideo_041120_Fauchon_Web_copyright_Sennse-cbadet_012.jpg", "/user/themes/epau-antimatter/images/04_photo_ AE_PlanDAou_36.jpg",];
|
|
|
|
var counter = 1;
|
|
var duration = 4000;
|
|
var tTime = 0;
|
|
var v = setInterval(function() {
|
|
$('.parallax-mirror').animate({
|
|
'opacity': 0
|
|
}, {
|
|
duration: tTime,
|
|
complete: function() {
|
|
|
|
$(this).find('img').attr('src', imgSrc[counter]).end().animate({
|
|
'opacity': 1
|
|
}, tTime);
|
|
|
|
}
|
|
});
|
|
|
|
if (counter > imgSrc.length - 1) {
|
|
counter = 0
|
|
} else {
|
|
counter++
|
|
};
|
|
},
|
|
duration);
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
// Animation souligné if inView
|
|
function isScrolledIntoView(elem) {
|
|
var docViewTop = $(window).scrollTop();
|
|
var docViewBottom = docViewTop + $(window).height();
|
|
|
|
var elemTop = $(elem).offset().top;
|
|
var elemBottom = elemTop + $(elem).height();
|
|
|
|
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
|
|
}
|
|
$(window).scroll(function () {
|
|
$('.souligne.toleft').each(function () {
|
|
if (isScrolledIntoView(this) === true) {
|
|
$(this).addClass('in-view')
|
|
} else {
|
|
$(this).removeClass('in-view')
|
|
}
|
|
});
|
|
$('.souligne.toright').each(function () {
|
|
if (isScrolledIntoView(this) === true) {
|
|
$(this).addClass('in-view-right')
|
|
} else {
|
|
$(this).removeClass('in-view-right')
|
|
}
|
|
});
|
|
});
|