suite
This commit is contained in:
parent
fd4050d482
commit
c2574707db
@ -9,20 +9,30 @@
|
||||
$(document).on("scroll", onScroll);
|
||||
function onScroll(event){
|
||||
var scrollPos = $(document).scrollTop();
|
||||
$('#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");
|
||||
}
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user