Files
dev-epau.archi.fr/user/themes/epau-antimatter/js/antimatter.js
T

190 lines
4.9 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");
}
// 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");
// }
// };
// var elements = document.getElementsByClass('souligne');
//
// elements.forEach(function(element) {
// new WhenInViewport(element, function(elementInViewport) {
// elementInViewport.classList.add('inViewport');
// });
// });
//
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
}
});
// parallax slideshow
$(document).ready(function() {
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",];
var counter = 1;
var duration = 4000;
var tTime = 300;
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);
});
// // souligne apparait on scrollLock
// $(function () {
// var element = $("#triggerOnScroll");
// $(window).scroll(function () {
// if($(window).scrollTop() > 0) {
// element.addClass("animateMe");
// }
//
// });
// 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();
// });
});