souligné H1, pas réussi animation js on scroll. alimation css hover ok

This commit is contained in:
2021-04-08 11:14:43 +02:00
parent e8db05cb6e
commit 03309f4e37
12 changed files with 248 additions and 624 deletions
+61 -2
View File
@@ -9,10 +9,31 @@ 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");
// }
// };
jQuery(document).ready(function($){
// paralax
// $('.parallax-window').parallax({imageSrc: '{/pages/02._programmes/10361_web_01.jpg}'});
// jQuery('.your-class-here').one('inview', function (event, visible) {
// if (visible == true) {
// //Enjoy !
// }
// });
// ON SCROLL EVENTS
@@ -59,4 +80,42 @@ jQuery(document).ready(function($){
});
// 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();
});
});