| 开发者 | josevarghese |
|---|---|
| 更新时间 | 2026年7月27日 04:12 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
.site-header, #masthead, or header.main-nav) to target the exact element you want to stick.
Scroll Trigger Distance
Control how far the user must scroll down the page before the header becomes sticky. The default is 0 px, meaning the header sticks immediately. You can increase this value (up to 5000 px) so the header only sticks after the user has scrolled past the hero or page banner, keeping the top of the page clean.
Top Spacing (Sticky Offset)
Add extra pixel space between the very top of the viewport and the sticky header. This is useful when you want breathing room above the header or when other fixed elements occupy part of the top of the screen.
WordPress Admin Bar Awareness
When a user is logged in to WordPress, the admin toolbar appears at the top of the page and the sticky header automatically positions itself directly below it, with no overlap. This adjustment happens in real time and accounts for any height changes the admin bar makes at different screen widths.
Hide on Scroll Down
Enable this option to slide the sticky header out of view while the user is scrolling down the page. This reclaims screen real estate and gives readers more room to focus on content. When the user scrolls back up, the header smoothly returns to view.
Show on Scroll Up
Works together with Hide on Scroll Down. When enabled, the header reappears as soon as an upward scroll is detected. You can leave this off if you only want the header to return after the user scrolls all the way back to the top of the page.
Scroll-Up Distance Threshold
When Hide on Scroll Down and Show on Scroll Up are both active, this setting controls how many pixels upward the user must scroll before the header reappears. The default is 0 px, which means the header reappears instantly on any upward movement. Increasing this value (up to 300 px) prevents the header from flickering back into view when the user makes small, accidental upward movements at the bottom of a page.
Shrink on Scroll (Compact Mode)
When enabled, the sticky header automatically reduces its top and bottom padding as soon as it becomes sticky, giving it a slimmer, more modern look. A configurable Sticky Padding slider (0–50 px, default 8 px) lets you set exactly how much vertical padding the header should have while it is sticky. The transition between normal and compact size is animated using the same speed setting as other transitions. This is one of the most popular patterns in modern web design and requires no custom CSS.
Push-Up Element
Specify a CSS selector for an element (such as a footer or an in-page banner) that will push the sticky header out of view as it scrolls into the header's position. This prevents the sticky header from overlapping important content near the bottom of the page. The push-up movement is calculated in real time based on the element's position relative to the header.
Enter Animations
Choose an animation that plays once when the header first becomes sticky:
backdrop-filter: blur() effect behind the header, creating the popular frosted-glass (glassmorphism) look. Combine a white background at around 85% opacity with 8–12 px of blur for a clean, modern glass-effect sticky header — no custom CSS required.
Responsive Breakpoint Control
Two independent width controls let you disable the sticky behavior at specific screen sizes:
mshms-is-sticky to the header element whenever it is in its sticky state, and mshms-not-sticky when it is not. These classes make it easy for developers and theme customizers to write CSS that targets each state independently, for example to change the logo size, font color, or padding when the header is sticky.
Display On (Page Type Control)
Choose exactly which types of pages the sticky header should be active on. The available options are:
menudoc-sticky-header-menu-on-scroll folder to the /wp-content/plugins/ directory, or install the plugin directly from the WordPress plugin repository via Plugins - Add New.Yes, in almost all cases. The plugin uses a prioritised list of selectors and HTML structures that covers the vast majority of WordPress themes, including classic themes, popular page builder themes, and full-site editing (block) themes built with the WordPress Site Editor.
Switch the detection mode to Custom Selector and enter the CSS selector for your exact header element. You can find the correct selector by inspecting the header in your browser's developer tools.
No. When the plugin is disabled from the settings page, no CSS or JavaScript is loaded on the front end at all.
Yes. Enable the CSS State Classes option and use .mshms-is-sticky in your custom CSS to target the header in its sticky state. You can apply any CSS property: different background, reduced padding, smaller logo via a child selector, and so on.
Yes. Enable the Custom Background option and choose a color. That color is applied only when the header becomes sticky, so the header can remain transparent at the top of the page and switch to a solid (or semi-transparent) background once the user scrolls. Use the Background Opacity and Backdrop Blur sliders for a frosted-glass effect.
Enable Custom Background, set the background color to white (or your site's primary color), reduce Background Opacity to around 80–90%, and set Backdrop Blur to 8–12 px. That produces a translucent, blurred header with no custom CSS required. Browser support for backdrop-filter is excellent in all modern browsers.
Enable Hide on Scroll Down and Show on Scroll Up, then set the Scroll-Up Distance Threshold to a value like 80–120 px. The header will only reappear after the user has scrolled upward by that many pixels, eliminating flicker caused by small accidental upward movements.
Yes. Enable Shrink on Scroll in the Appearance card and use the Sticky Padding slider to set the desired padding when the header is sticky. The transition is smooth and animated. If you need to change font size or logo size in addition to padding, enable CSS State Classes and write a rule targeting .mshms-is-sticky.
backdrop-filter.