Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIAi2 WildChat-4.8M (AI2)

using elementor in wordpress, is there any way possible to keep the header menu stick…

  1. User

    using elementor in wordpress, is there any way possible to keep the header menu stick even in page transitions, so the transition works in page canvas not head or footer?

  2. Assistant

    Great question! When using Elementor in WordPress, you can create smooth page transitions by using certain plugins or custom methods. Your goal is to keep the header menu sticky and persistent, so it doesn’t re-render or flicker during page transitions — in other words, the header (and footer) stays fixed, and only the "page canvas" or main content area transitions smoothly.


    Why this is tricky:

    • WordPress by default reloads the entire page on navigation.
    • Elementor headers/footers are part of the full page.
    • When navigating pages, the entire DOM unloads and reloads, so you lose sticky menus or fixed headers until the new page loads.
    • Page transition effects usually mean animating the whole page, so header/footer reloads too.

    Is this possible in Elementor? Yes, but requires:

    • Using AJAX page loading or PJAX methods (partial AJAX)
    • Or specific page transition plugins that support persistent elements
    • Custom JavaScript to keep header/footer alive across navigations

    How to keep header sticky during page transitions in Elementor

    1. Use a page transition plugin that supports persistent containers

    A few page transition plugins support excluding certain elements from reloads or define persistent containers. Examples:

    • Barba.js (a popular JS library for PJAX + transitions) + Elementor

      • Barba.js can be integrated manually.
      • You define persistent containers (e.g., header and footer) so they're not removed in navigation.
      • Only the page canvas (main content) updates with fade/slide transitions.
    • PJAX or Turbo-type plugins

    • Page transition plugins on WordPress that support exclusion or persistent elements:

      • Swup with Elementor — There’s a WordPress plugin and some tutorials integrating Swup PJAX transitions with Elementor and defining persistent parts like header/menu.

    These require adding custom JS to your theme or via Elementor's custom code integration.


    2. Elementor + Barba.js custom setup (example)

    • Wrap your entire page content with data attributes Barba needs:
    <div id="barba-wrapper">
      <header>...Your Elementor header here...</header>
    
      <div id="barba-container" data-barba="container">
        <!-- Main content loaded here dynamically -->
      </div>
    
      <footer>...Footer elementor template...</footer>
    </div>
    
    • Then initialize Barba in a JS file loaded on your site:
    barba.init({
      sync: true,
      transitions: [{
        name: 'fade',
        leave(data) {
          return gsap.to(data.current.container, {opacity: 0, duration: 0.5});
        },
        enter(data) {
          return gsap.from(data.next.container, {opacity: 0, duration: 0.5});
        }
      }],
      views: [{
        namespace: 'home', // page namespace if needed
        beforeEnter(data) {
          // Re-init any Elementor scripts/components here if needed
        }
      }],
      prevent: ({ el }) => el.classList && el.classList.contains('no-barba') // optional
    });
    
    • The header/footer stay outside #barba-container, so they persist.
    • Only the #barba-container content reloads.

    3. Use an Elementor compatible page transition plugin that supports persistent header

    Look for plugins like:

    • "Motion.page" — offers advanced page transition effects and sticky header persisting.
    • "Elementor page transition" plugins on WordPress repo — check documentation for persistent elements.

    4. Important: Sticky header CSS

    Make sure your header is properly sticky (position: fixed or sticky) and has a z-index so it appears over the transitioning content. Example CSS for sticky header:

    header {
      position: fixed;
      top: 0;
      width: 100%;
      z-index: 9999;
      background: #fff;
    }
    body {
      padding-top: 70px; /* height of header */
    }
    

    This helps keep header visible and floating.


    5. Summary:

    StepDescription
    Use PJAX / Barba.js / SwupEnable partial page loading + transitions
    Define persistent containersMake header/footer outside of dynamic content container
    Adjust header CSSEnsure sticky/fixed position and z-index
    Reinitialize widgets/scriptsReload Elementor/relevant JS on content reload

    Final thoughts

    • Elementor out of the box does not support smooth persistent header transitions across page loads because WordPress reloads everything.
    • Implementing AJAX page transitions with persistent header container is the common solution.
    • This requires custom coding or a premium plugin.
    • Barba.js + Elementor is a popular approach, but requires intermediate JavaScript knowledge.
    • Alternatively, look for third-party Elementor plugins that offer this functionality.

    If you want, I can help you with a basic Barba.js + Elementor integration example or suggest some good plugins. Would you like that?