1. PROMO Subscribe our All Access Pass @ 75% OFF & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Solved Sticky Header styling options applied without scrolling

Discussion in 'Free Divi Community Forum' started by Stefanie Bayer, May 7, 2024.

  1. Stefanie Bayer

    Stefanie Bayer New Member

    Hi guys, I just configured a sticky custom header and the issue is that the sticky styling is applied even without scrolling. I search my way through google and the only issue I could find (actually in this forum) is a problem in correlation with Divi Booster which I haven't installed.
    Anyone any ideas what to do?

    I applied the sticky option to the section and wanted to change the background color when the header gets sticky...

    Thanks in advance for any advice,
    Stefanie
     

    Attached Files:

    1. PRO MEMBER PERKS Divi Block Pro - Premade slide in bar design for your Divi site without using any plugins:View Demo
  2. Stefanie Bayer

    Stefanie Bayer New Member

    I think I figured it out afterall... The way I designed this was with two sections in the custom header and played around with it - only sticking the top (yellow) header which worked fine. And then I wanted to stick both headers - this showed the "wrong" scrolling effect mentioned above.
    What I tried now was removing the yellow secondary header and now all effects work perfectly on the main header... So I guess if you want both headers to be sticky you need to put them into one section, otherwise the second section thinks the scrolling has already happend.

    Any confirmations / experiences from other Divi users?
     
  3. Divi Booster

    Divi Booster Divi Expert

    Hey Stefanie, I think you're pretty much spot on. When a section becomes sticky it is conceptually removed from the page and layered above it. Your top header would be sticky right away (being at the top of the page) and so would be removed from the page. This means that the first thing in the page would be the second section. And since it's now at the top of the page, it would behave as if the scrolling had already happened and it too would immediately become sticky.

    If it works for you, putting them both in the same section would be the simplest solution. For more complex situations, I think you could probably use the "Sticky Top Offset" and "Offset From Surrounding Sticky Elements" (as shown in one of your screenshots) to change what point in the scroll they become sticky and where they are placed once they are sticky.

    By the way, if you still have that Divi.Help thread relating to Divi Booster, would you mind sharing it here - I'd love to take a look. Divi Booster has a couple of features for adding sticky widget areas (which behave a bit like sticky sections), so perhaps it relates to those..
     
    1. PRO MEMBER PERKS Divi.Help Layout AI Generator - Try the power of AI to generate a custom Divi layout for you:Try Now
  4. Stefanie Bayer

    Stefanie Bayer New Member

    Hey, thanks for your answer :) First, I thought - ah, that explains it. But then... if the top header would become sticky right away, why does it work with the non-sticky / sticky states when I combine the two menus/headers in one section? Then it shows me the non-sticky state on load and only after scrolling the sticky state layouting... I'm just wondering.

    Here is the thread on the divi booster: https://divi.help/threads/sticky-modules-and-sticky-header.11067/
     
  5. Stefanie Bayer

    Stefanie Bayer New Member

    1. PRO MEMBER PERKS Divi Block Pro - Easy-to-use drag & drop interface to mix & match 456+ premade Divi blocks & export as json file:Learn More
  6. Divi Booster

    Divi Booster Divi Expert

    Hey Stefanie,

    First, thanks for the forum link. I'll take a look at that shortly and see if it's something I need to address or not. Much appreciated.

    You're right. My explanation doesn't quite cut it. I've set up a test on my site and think I can now see what's actually going on.

    With the default Divi settings, when the first two sections in the page are both sticky, they are actually displayed right at the point where they should become sticky. So in theory, both sections should be marked as sticky right from the get-go.

    However, I think Divi is doing some tweaking of this behavior. In particular, since many people would expect a fixed header section to start in the non-fixed state, it makes sense that the first section starts of as non-sticky and only turns sticky when the page scrolls. On the other hand, if the page loaded somewhere further down the page (on a page refresh, say), then it would make sense that any sections currently at the point where they should be sticky be immediately displayed as such. For example, a sticky social media bar that becomes sticky half-way down the page should immediately display as sticky if the page is reloaded while the bottom of the page is in view (rather than waiting for the user to scroll).

    This seems to be what Divi is doing, immediately marking any section (other than the first) as sticky if it is in the correct position. The problem comes with the likes of your second section. There's no reliable way for Divi to tell if such sections are meant as an extension of the header, or as a piece of sticky content. It looks like Divi has decided to treat them as sticky content and display them as sticky initially.

    So in your two header case, the first is treated like a header and marked as non-sticky, while the second is treated as a bit of sticky content and marked as sticky.

    When you switched to a single section, now the whole unit is treated as a sticky header and displayed as non-sticky initially, changing to sticky on scroll.

    There is a solution to make the second section start non-sticky initially, but become sticky as soon as the page scrolls. Simply set:

    Section Settings > Advanced > Scroll Effects > Sticky Top Offset = -1px

    The -1px means that you need to scroll at least one px down the page before the sticky effect is activated. Then it behaves the same as the top section.

    Sorry, that was a bit long... hope it provides a better explanation!
    Dan
     
  7. Divi Booster

    Divi Booster Divi Expert

    1. PRO MEMBER PERKS Divi.Help Pro Layout Packs - Modern & powerful Agency Divi layout pack, featuring team carousel, sliding menu, etc.View Demo
  8. Stefanie Bayer

    Stefanie Bayer New Member

    Thanks für your insights, I can understand now why Divi won't recognize the second header as non sticky at loading the page.
    I think it's not really an issue, because I can still decide if I just want the first, the second or both headers sticky and define them in separate sections or in one section.
     
  9. Divi Booster

    Divi Booster Divi Expert

    You're welcome, Stefanie. Yeah, now that we understand it, it's easily worked around :)
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade promo bar / notification bar with close button for your Divi site without using any plugins:View Demo