Usama Afzal 4.9 (400) E-commerce manager SEO specialist Website developer Posted November 19 0 To add a sticky navigation bar on scroll in WordPress: 1. Use a Plugin: - Install a plugin like myStickymenu or Sticky Menu (or Anything) on Scroll. - Activate the plugin and follow the settings to make your navigation bar sticky. 2. Manual Method (Using CSS): - Go to Appearance > Customize > Additional CSS. - Add the following CSS code: .your-navbar-class { position: -webkit-sticky; position: sticky; top: 0; z-index: 999; } - Replace `.your-navbar-class` with the class or ID of your navigation menu (you can find this by inspecting the element). 3. Using a Theme Builder: - If you’re using a theme builder like Elementor, look for a "Sticky" option in the menu widget settings and enable it. These methods will help your navigation bar stay visible as users scroll down the page. See profile Link to comment https://answers.fiverr.com/qa/14_programming-tech/56_website-development/how-do-i-add-a-sticky-navigation-bar-on-scroll-in-wordpress-r1200/#findComment-3327 Share on other sites More sharing options...
The Dot Dev 4.9 (779) Website developer Posted October 14 (edited) 0 Adding a sticky navigation bar (a menu that stays fixed at the top of the screen as users scroll) is a great way to enhance the user experience on your WordPress site. It helps visitors easily navigate your site without having to scroll back to the top. Here are a few ways to add a sticky navigation bar to your WordPress site: Method 1: Using a Plugin (Easy Option) The simplest way to add a sticky navigation bar is by using a plugin. Here's how you can do it: 1. Install and activate the “Sticky Menu & Sticky Header” plugin: - From your WordPress dashboard, go to **Plugins** → **Add New** and search for "Sticky Menu & Sticky Header." - Install and activate the plugin. 2. Configure the plugin settings: - After activating the plugin, go to Appearance → Sticky Menu (or Anything!) settings. - In the settings, you'll see a field called Sticky Element. Enter the class or ID of your navigation bar (you can inspect your theme’s navigation in your browser’s developer tools to find the correct class/ID, e.g., `#main-nav` or `.navbar`). 3. Save and test: - Save the settings, and your navigation bar should now stay fixed at the top as you scroll through the site. This method is ideal for beginners because it requires no coding. Method 2: Adding Custom CSS (Intermediate Option) If you prefer a lightweight solution without using plugins, you can add custom CSS to make your navigation bar sticky. Here’s how to do it: 1. Find the class/ID of your navigation bar: - Inspect your site’s navigation bar using your browser's developer tools (right-click on the navigation bar and select "Inspect"). Note the class or ID (e.g., `#main-nav`, `.navbar`). 2. Add custom CSS: - Go to **Appearance** → **Customize** → Additional CSS in your WordPress dashboard. - Add the following CSS code: #main-nav { position: fixed; top: 0; width: 100%; z-index: 9999; } body { padding-top: 60px; /* Adjust this value to the height of your navigation bar */ } - Replace `#main-nav` with the actual class or ID of your navigation bar. 3. Save and test: - Save your changes, refresh your website, and scroll to see the sticky navigation in action. Method 3: Using Page Builders (Elementor, WPBakery, etc.) If you’re using a page builder like Elementor or WPBakery, they often have built-in features to make elements sticky. For instance, in Elementor, you can set a section (like your header) to be sticky through the following steps: 1. Edit the page with Elementor: - Open the page where your navigation bar is located. 2. Select the navigation bar section: - Click on the section that contains your navigation bar. 3. Enable sticky option: - In the left panel, go to **Advanced** → Motion Effects. - Under Sticky, choose Top. 4. Save your changes. Using page builders makes this process easy without requiring any coding or external plugins. --- These methods give you flexibility depending on your level of expertise and whether you prefer using plugins, custom CSS, or a page builder. A sticky navigation bar enhances user experience, keeping important links accessible no matter how far users scroll. Edited October 15 by Fiverr Answers Alex Cleaned up See profile Link to comment https://answers.fiverr.com/qa/14_programming-tech/56_website-development/how-do-i-add-a-sticky-navigation-bar-on-scroll-in-wordpress-r1200/#findComment-1901 Share on other sites More sharing options...
Gvrdenu 5.0 (427) SEO specialist Posted October 14 0 There are several ways to create a sticky navigation bar. Depending on how much technical knowledge you have, you choose the method that is easiest for you. Use a compatible theme The easiest way is to add sticky navigation bar is enable this option in the theme settings if your theme supports it. Some of the themes that have this option: Flexia, OceanWP, Hello, Divi, Astra. Use page builder plugins Some of the page builders such as Visual Composer, Elementor or WPBakery have the option to create a sticky navigation bar. Add sticky navigation bar using a plugin The another easy way to add a sticky navigation bar in WordPress is by using the plugins like: Sticky Menu & Sticky Header, My Sticky Bar or Float menu – awesome floating side menu. Add sticky navigation bar using a CSS code We can also create a sticky navigation bar using CSS. From your WordPress dashboard Go to Appearance -> Customize and Click Additional CSS and add this code: .menu-navigation { position:fixed; background:#fff; height:80px; width:100%; z-index:9999; margin:0 auto; border-bottom:1px solid #ddd; top:0; left:0; right:0; } Replace ".menu-navigation" with your navigation menu CSS class or ID. See profile Link to comment https://answers.fiverr.com/qa/14_programming-tech/56_website-development/how-do-i-add-a-sticky-navigation-bar-on-scroll-in-wordpress-r1200/#findComment-1867 Share on other sites More sharing options...
Recommended Comments