It seems we can’t find what you’re looking for. Perhaps searching can help.

jQuery(document).ready(function($) { $(window).on('scroll', function() { var scrollPos = $(document).scrollTop(); $('section').each(function() { var top = $(this).offset().top - 100; // adjust offset if you have sticky header var bottom = top + $(this).outerHeight(); var id = $(this).attr('id'); if (scrollPos >= top && scrollPos < bottom) { $('nav a').removeClass('active'); $('nav a[href="#' + id + '"]').addClass('active'); } }); }); });