event addClass when in view fonctionne mais animation non

This commit is contained in:
2021-04-19 20:11:12 +02:00
parent 25cc038e98
commit aa9e3d6cc5
11 changed files with 135 additions and 234 deletions
+29 -83
View File
@@ -9,35 +9,12 @@ function scrollHeader() {
$("#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"
//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
@@ -53,12 +30,12 @@ jQuery(document).ready(function($){
// 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 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() {
var counter = 1;
var duration = 4000;
var tTime = 300;
var v = setInterval(function() {
$('.parallax-mirror').animate({
'opacity': 0
}, {
@@ -76,31 +53,16 @@ jQuery(document).ready(function($){
counter = 0
} else {
counter++
};
},
duration);
};
},
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 !
// }
// });
@@ -149,41 +111,25 @@ jQuery(document).ready(function($){
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();
// });
});
// 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').each(function () {
if (isScrolledIntoView(this) === true) {
$(this).addClass('in-view')
}
});
});