73 lines
1.8 KiB
JavaScript
Executable File
73 lines
1.8 KiB
JavaScript
Executable File
// Par Nicolas VARROT (Olwen Capital)
|
|
(function(){
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
|
|
|
// Pour que le menu soit active en fonction du scroll
|
|
$(document).on("scroll", onScroll);
|
|
function onScroll(event){
|
|
var scrollPos = $(document).scrollTop();
|
|
|
|
if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - 10)) {
|
|
|
|
$(".menu a").removeClass("active");
|
|
$(".menu a:last").addClass("active");
|
|
}
|
|
else{
|
|
$('#top_bar ul>li>a').each(function () {
|
|
var currLink = $(this);
|
|
|
|
var refElement = $("#" + currLink.attr("data-link"));
|
|
if(refElement.html()){
|
|
if (refElement.position().top <= scrollPos + 54 && refElement.position().top + refElement.height() > scrollPos + 54) {
|
|
$('#top_bar ul>li>a').removeClass("active");
|
|
currLink.addClass("active");
|
|
}
|
|
else{
|
|
currLink.removeClass("active");
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Pour que les élements s'animent au scroll
|
|
|
|
|
|
$(".animated-block > *").css('opacity', 0);
|
|
|
|
var options = {offset:"100%"};
|
|
|
|
|
|
|
|
$('#header, #footer, #edito, #home, #products').waypoint(function(direction) {
|
|
|
|
contentAnimation(this.element);
|
|
},options);
|
|
|
|
|
|
function contentAnimation(element){
|
|
|
|
if($(element).attr("animation-done") != "true"){
|
|
$(element).find("*").addClass('animated fadeInUp');
|
|
$(element).css("overflow", "hidden");
|
|
$(element).find("*").css('opacity', 1);
|
|
|
|
setTimeout(function(){
|
|
$(element).find("*").removeClass('animated fadeInUp');
|
|
$(element).attr("animation-done","true")
|
|
},1000)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})()
|