Skip to main content
100%

Scroll Highlighting (as seen at http://geojson.org/geojson-spec.html)

✓ Published0🌍 Public
RRestuta
Last edited Aug 4, 2015
Created on Aug 4, 2015

This example shows a navigation menu that automatically highlights the section currently visible in the viewport as the user scrolls. The code uses jQuery to listen for window scroll and resize events, then checks each heading’s offset position against the viewport bounds to determine which one is active. It applies “active” and “first” CSS classes to corresponding navigation links via `$('#nav a')`, and it runs once on page load. The data comes from the headings’ `id` attributes in the document, as seen in the GeoJSON specification page.

AI-generated description

Similar vizzes