[Resolved] Hide header on scroll down, show on scroll up

  • Author
    Posts
  • #13219

    Jonas
    Participant

    I’m a very happy user of the Polestar theme. I was wondering if you could advice me on what code to apply in order to make the top menu / header disappear on scroll down and re-appear on scroll up. (Sort of a mix between the sticky and non-sticky options currently available in the theme).

    Thanks a lot!

    #13221

    Andrew Misplon
    Keymaster

    Hi 🙂

    Thanks for your question and feedback.

    This would need to be done using JavaScript. I’ll take a look and come back to you during the week, hopefully with a solution.

    Chat further then.

    #13228

    Andrew Misplon
    Keymaster

    Hi again

    You can try the following snippet. Right click and save as to download the file to your desktop. To make use of the file, got to Plugins > Add New, search for and install a plugin called Code Snippets. Once activated, go to Snippets > Import to import this file. Ensure the snippet is set to run on the site front-end, save and activate.

    This snippet isn’t perfect, it currently isn’t offset for the WordPress admin toolbar and doesn’t currently work well with the Polestar one page scrolling functionality. Whether or not this is a problem will depend on how you’re using Polestar.

    Let me know how it goes. Thanks.

    #13229

    Andrew Misplon
    Keymaster

    When trying this snippet out it’s best to deactivate the theme’s Sticky Header setting at Customize > Theme Settings > Header.

    Header

    Thanks

    #13230

    Jonas
    Participant

    Hi Andrew,

    It works! Thank you so much for your work and your quick replies. You’re right, it’s not offset for the admin toolbar, but from a user perspective it works really well. It would be great if you could include this option in a future update of the Polestar theme. (And perhaps even include the option to use it on smaller screens only). Thank you so much for your time and please let me know if you decide to develop this function further (which I hope you will).

    Thanks!

    #13234

    Andrew Misplon
    Keymaster

    Super, glad to hear that helps.

    Thanks for your feedback. If I’m able to develop this further into a theme setting, I’ll certainly keep you updated.

    Cheers for now 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Scroll to top