Make a fixed navbar switch color or style automatically as the user scrolls past different sections.
Show a custom-markup header (with extra elements) for specific page sections.
Run multiple independent nav bars on one page with different scroll triggers.
| aerolab/midnight.js | mac-s-g/react-json-view | race604/zhihudaily-react-native | |
|---|---|---|---|
| Stars | 3,658 | 3,658 | 3,657 |
| Language | JavaScript | JavaScript | JavaScript |
| Setup difficulty | easy | easy | moderate |
| Complexity | 2/5 | 2/5 | 2/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires jQuery, install via npm, Bower, or a CDN script tag.
Midnight.js is a small jQuery plugin that changes the appearance of a website's fixed navigation bar as the user scrolls down the page. Instead of having a single header style that may clash with different sections (a dark logo that becomes unreadable over a dark image, for example), Midnight automatically swaps in a different version of the header as each section comes into view. The way it works is straightforward. Developers create a single fixed navigation bar in HTML as usual, then tag each page section with a custom attribute indicating which header style should be active when that section is visible. Midnight reads those tags as the page scrolls and clips the visible header to match the right style at the right moment. Multiple distinct header designs can be defined by writing different CSS classes, and Midnight handles the switching without any extra JavaScript beyond a single initialization call. For sections that need more than just a color change, the plugin supports custom markup per header version. A section might display a header with completely different inner elements, not just a different background color. All header versions are required to be the same height, since they are layered and clipped rather than swapped out entirely. The plugin can also run in multiple instances on the same page with different trigger attributes, which is useful if a site has more than one fixed navigation bar that should respond to different scroll sections independently. Known limitations include choppy behavior on older iOS and Android devices, where the scroll position does not update smoothly enough to keep the header transition fluid. The plugin is available through npm and Bower, and can be loaded from a CDN. It requires jQuery to function.
A jQuery plugin that automatically swaps a website's fixed navbar style as different page sections scroll into view.
Mainly JavaScript. The stack also includes JavaScript, jQuery, CSS.
No license is stated in the README.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.