How To Make Any Divi Section, Row, Or Module Sticky
The first method here will work for any section, row, or module on the page. All you have to do is copy the code below and put in the elment you want to make sticky. Just go to the settings of the section, row, or module to the Advanced tab, then open the Custom CSS toggle, and paste it in the Main Element.
Now when you scroll and that element reaches the top, it will stick there. When you scroll back down it will return to it’s oringal placement.
Once again, this is perfect for a header menu. You might want to have a hero section with a big image, then when you scroll the menu scrolls up and becomes sticky. This method is very simple, and should work well in a lot of cases.
How To Make A Divi Theme Builder Header Menu Sticky
This Is Intended for Headers with Multiple Sections
The idea here is to have more than one section in the Divi Theme Builder header. If you want, you can check out our previous tutorial on how to make the entire Divi Theme Builder header fixed, but in this case we only want to make one of the sections fixed to the top when scrolling. In other words, we want to make the menu sticky but the rest of it behave like normal.
From your WordPress Dashboard, go to Divi>Theme Builder. Create a new template, and assign where needed. In our example, we chose to assign the menu to a specific page, but you may want this as your Global Header instead.
Click on “Add Custom Header” and in the popup choose “Build Custom Header.”
Builder The Header
At this point you can buid your header template however you want. The key here is to have more than one section. If you have two sections, the lower one will stay fixed when scrolling.
Add A CSS Class
Choose the section you want to stay fixed when scolling, and go into the settings to the Advanced tab and open the Custom CSS ID & Classes toggle. Paste the CSS class “pa-header” in the CSS Class input.
Add Some JQuery Code
Next, we need to add some code to make this work. Copy the snippet below and paste it in the Divi>Theme Options>Integration tab to the < head > of the blog section. For more information you can check out our full guide on where to add code in Divi.
Add Some CSS Code
The last step is to add a small snippet of CSS to your website. You can copy and paste this snippet into your Divi>Theme Options>Custom CSS box.