How to “Pick up” Your Divi Sticky Header When Passing Your Page’s Hero Section

Last Updated on September 16, 2022 by 8 Comments

How to “Pick up” Your Divi Sticky Header When Passing Your Page’s Hero Section
Blog / Divi Resources / How to “Pick up” Your Divi Sticky Header When Passing Your Page’s Hero Section

Ever since the Divi sticky options update has been released, weโ€™ve been sharing tips and tricks on how to use them throughout your website builds with Divi, and today, weโ€™re adding another one for you to bookmark! This tutorial will be all about interaction. Weโ€™ll automatically place a custom header below each pageโ€™s hero section and turn that header sticky as soon as visitors scroll past it, which results in a beautiful scrolling experience. Youโ€™ll be able to download the JSON file for free as well!

Letโ€™s get to it.

Preview

Before we dive into the tutorial, letโ€™s take a quick look at the outcome across different screen sizes.

Desktop

pick up header

Mobile

pick up header

Download The Template for FREE

To lay your hands on the free page template, you will first need to download it using the button below. To gain access to the download you will need to subscribe to our newsletter by using the form below. As a new subscriber, you will receive even more Divi goodness and a free Divi Layout pack every Monday! If youโ€™re already on the list, simply enter your email address below and click download. You will not be โ€œresubscribedโ€ or receive extra emails.

1. Create a New Page Using Diviโ€™s Upholstery Layout Pack Landing Page

For this tutorial, weโ€™re going to use the Upholstery Layout Pack and its free header and footer template that you can download on the blog. Although weโ€™re using this particular layout pack, you can apply this method to any kind of website youโ€™re building. To preview the result while going through the tutorial below, we recommend you set up a page that you keep open in a separate tab. To match the header and footer weโ€™ll use, weโ€™re setting up a new page using a layout of choice that comes with Diviโ€™s Upholstery Layout Pack.

pick up header

2. Download & Install the Free Header & Footer for Diviโ€™s Upholstery Layout Pack

Download the Free Header & Footer on Our Blog

Next, weโ€™ll download the free header and footer template for Diviโ€™s Upholstery Layout Pack. Downloading and installing this freebie will help us focus on the important part of this tutorial, which is getting the technique right. Once youโ€™ve gone to the blog post, navigate to the email optin form and fill in your email address. Then, a download button will appear. This download button will allow you to download a zipped folder. Once youโ€™ve unzipped the folder, you can find a JSON file that contains a default website template with a global header and footer.

pick up header

pick up header

Navigate to Diviโ€™s Theme Builder

To use the JSON file youโ€™ve just downloaded, navigate to your Divi Theme Builder.

pick up header

Upload the Default Website Template with Header & Footer Designs

There, click on the import & export button in the top right corner and upload the JSON file you can find in your download folder.

pick up header

pick up header

Create New Page Template

As soon as youโ€™ve uploaded the template, youโ€™ll see a global header and footer appear inside your default website template. To avoid weird header placements, weโ€™ll only apply the โ€œpick up sticky headerโ€ effect to our pages, but if you have a Divi-built hero section on other custom post types too, feel free to use the header there as well. Add a new template and use it on all pages.

pick up header

  • Use On: All Pages

pick up header

Remove Header & Footer Template from Default Website Template

As soon as you add the page template, the global header and footer will automatically be added to that template. Weโ€™re turning this global header into a custom header by removing the global header and footer in our default website template. This way, the changes we make to our header will only apply to pages.

pick up header

3. Place Header Section Below Hero Section

Open Global Header Template

Now that weโ€™ve set up the theme builder environment for our header, itโ€™s time to switch over to our header template by clicking on the pencil icon.

pick up header

Assign a Custom CSS ID to Section Inside Global Header

Once inside the template editor, youโ€™ll see a header design that contains a section, row and a couple of modules. To automatically place the header below each pageโ€™s first hero section, weโ€™re going to need to assign a custom ID to our section. The technique weโ€™re using is based on a previous tutorial. The difference between this post and the one mentioned in the previous sentence is that as soon as a visitor passes by the header, itโ€™ll be turned sticky. When people scroll back up, itโ€™ll take back its place below the hero section.

  • CSS ID: custom-header

pick up header

Add Code Module Below Menu Module in Column 1

Continue by adding a new Code Module to the rowโ€™s first column.

pick up header

Add JQuery Code to Place Section Below Each Pageโ€™s First Section

There, weโ€™ll insert some JQuery code thatโ€™ll automatically place the header section below each pageโ€™s first hero section.

jQuery(function($){
$(document).ready(function(){
$('#custom-header').insertAfter('.et_pb_section_0');
});
});

pick up header

Add CSS Code to Same Code Module

Weโ€™ll include a CSS class between style tags too to prevent the header from showing up in the builder while building pages.

#et_pb_root #custom-header {
display: none;
}

pick up header

4. Apply Sticky Position & Styles to Header

Add Sticky Positioning to Section

Now that our section is placed below each pageโ€™s first hero section, itโ€™s time to apply the sticky effect too. To do that, weโ€™ll use Diviโ€™s built-in sticky settings in the advanced tab.

  • Sticky Position: Stick to Top

pick up header

Add Sticky Box Shadow to Section

Now that the sticky position has been applied, we can start making sticky changes to our section and all child elements it contains. Weโ€™ll start by adding a sticky box shadow to our section container.

  • Box Shadow Blur Strength: 30px
  • Shadow Color
    • Default: rgba(0,0,0,0)
    • Sticky: rgba(0,0,0,0.13)

pick up header

Modify Sticky Row Gradient Background

Then, weโ€™ll apply a sticky gradient background to our row.

  • Color 1: #ffffff
  • Color 2: #e8e8e8

pick up header

Modify Sticky Menu Module Text Color

Then, weโ€™ll open the Menu Module and change the menu text color in a sticky state.

  • Menu Text Color: #2d2e34

pick up header

Modify Sticky Menu Hamburger Icon Color

Weโ€™ll modify the sticky menu hamburger icon color too.

  • Hamburger Menu Icon Color: #2d2e34

pick up header

Add Sticky Logo Invert Filter

And weโ€™ll complete the tutorial by adding an image invert filter. Thatโ€™s it! Once youโ€™ve applied all these changes to your header, make sure you save the template and Divi Theme Builder changes before viewing the outcome on the page youโ€™ve created in the first part of the tutorial.

  • Image Invert: 80%

pick up header

Preview

Now that weโ€™ve gone through all the steps, letโ€™s take a final look at the outcome across different screen sizes.

Desktop

pick up header

Mobile

pick up header

Final Thoughts

In this post, weโ€™ve shared another tip and trick you can apply with Diviโ€™s built-in sticky options. More specifically, weโ€™ve shown you how to โ€œpick upโ€ your header once you scroll past it. The header will be automatically placed below each pageโ€™s first section. If you have any questions or suggestions, feel free to leave a comment in the comment section below!

If youโ€™re eager to learn more about Divi and get more Divi freebies, make sure youย subscribe to our email newsletterย andย YouTube channelย so youโ€™ll always be one of the first people to know and get benefits from this free content.

Divi Marketplace

Are You A Divi User? Find Out How To Get More From Divi! ๐Ÿ‘‡

Browse hundreds of modules and thousands of layouts.

Visit Marketplace
Divi Marketplace
Divi Cloud

Find Out How To Improve Your Divi Workflow ๐Ÿ‘‡

Learn about the new way to manage your Divi assets.

Get Divi Cloud
Divi Cloud
Divi Hosting

Want To Speed Up Your Divi Website? Find Out How ๐Ÿ‘‡

Get fast WordPress hosting optimized for Divi.

Speed Up Divi
Divi Hosting
Premade Layouts

Check Out These Related Posts

Get a Free Coffee House Layout Pack For Divi

Get a Free Coffee House Layout Pack For Divi

Posted on April 22, 2024 in Divi Resources

Hey Divi Nation! Thanks for joining us for the next installment of our weekly Divi Design Initiative; where each week, we give away a brand new Layout Pack for Divi. This time around, the design team has created a beautiful Coffee House Layout Pack thatโ€™ll help you get your next Coffee House...

View Full Post
Get a Free Butcher Shop Layout Pack for Divi

Get a Free Butcher Shop Layout Pack for Divi

Posted on April 15, 2024 in Divi Resources

Hey Divi Nation! Thanks for joining us for the next installment of our weekly Divi Design Initiative; where each week, we give away a brand new Layout Pack for Divi. This time around, the design team has created a beautiful Butcher Shop Layout Pack thatโ€™ll help you get your next Butcher Shop...

View Full Post

8 Comments

  1. How to make sticky transitions smoother?

  2. hello divi nation,
    If you include a custom body from the theme builder, you just have to change the tag in the jQuery code to hello divi nation, to .et_pb_section_0_tb_body

    saludos

  3. Thanks for this great tutorial ๐Ÿ™‚

    I tried to make all the steps as concentrated as i can, but i still have a “problem”.

    What do i have to do if I want my header image to be placed before the sticky menu ? Just as it’s done on your preview.

    I guess there’s a step i didn’t watch.

    Otherwise, it’s all good !

  4. I was so curious about this kind of header but was not able to make it properly! Really thankful to you so I got what I needed! Saved my money that I was going to give a freelancer to do this!

  5. This is a great tutorial as always ๐Ÿ™‚ I am tempted to implement it on my website. I’ve always liked this style of menu, as it draws extra attention to it in my opinion.

    • Thank you, Micheal ๐Ÿ™‚ It definitely helps draw attention to it, try it!

  6. This tutorial is quite helpful, thanks

    • Happy to hear that, Fem! ๐Ÿ™‚

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Join To Download Today