Créer une "class" au scroll
$(document).on("scroll", onScroll); onScroll(); var onScroll = function onScroll() { var is_scrolled = ($(document).scrollTop() <= 70); if (is_scrolled) { ... } }
$(window).on('scroll', function () { $('.block-chapter').each(function () { if ($(window).scrollTop() >= $(this).offset().top) { var id = $(this).attr('id'); $('#menu-center a').removeClass('active_link'); $('#menu-center a[href=#' + id + ']').addClass('active_link'); } }); });
