Type-Safe Development
Written in TypeScript with full type definitions, ensuring better development experience and fewer runtime errors.
ScrollReactiveNav is a lightweight TypeScript utility that creates smart, responsive navigation behavior. It automatically hides the navigation when users scroll down and shows it when they scroll up, providing an enhanced user experience for modern web applications.
Get StartedWritten in TypeScript with full type definitions, ensuring better development experience and fewer runtime errors.
Uses RequestAnimationFrame for smooth animations and passive event listeners for optimal performance.
Customize tolerance levels, start offsets, CSS class names, and bottom visibility behavior to match your design.
Pure TypeScript implementation with no external dependencies. Small bundle size for fast loading.
npm install scroll-reactive-nav@beta
import { ScrollReactiveNav } from 'scroll-reactive-nav';
// get your navigation element
const header = document.getElementById('header');
// initialize with default options
const nav = new ScrollReactiveNav(header);
// or with custom options
const nav = new ScrollReactiveNav(header, {
tolerance: 15,
showAtBottom: false,
classNames: {
base: 'my-nav',
hidden: 'my-nav--hidden'
}
});
.scroll-nav {
transition: transform 0.3s ease;
}
.scroll-nav--hidden {
transform: translateY(-100%);
}
.scroll-nav--fixed {
/* Additional styles for fixed state */
background: rgba(0, 0, 0, 0.9);
}
Questions about implementation? Need custom features? Feel free to reach out for support or collaboration on your next project with ScrollReactiveNav.