Forum Academy Marketplace Showcase Pricing Features

How do you make a header dissappear when scrolling down but appear again when scrolling up?

I wan’t to do what mobile website’s header does (see website under mobile web view)

The header is there in the beginning but as you start scrolling down, the header disappears. However if you scroll back up just a bit, the header appears again.

Anyone know how to do this with Bubble?


I’ve never tried this on mobile view before but try adding conditions on the header to appear/disappear when “current page’s scrolling position” is X pixels.

If you need to figure out at what pixel you want the change, add a text box with the text “current page’s scrolling position” and you can use a page preview to figure out the exact pixel.

So I know I can make the header appear/disappear at X pixel.

The problem is triggering the header to appear again as soon as the user scrolls up. This can happen at any pixel.

Kind of hacky…but. What I have done in the past was to just set 2 set states. One to get the current position and set another state to get the previous position. Then if the current position is less than the previous position then show header.

Then do a workflow to update the states each second.

Previous Position = Current position state
Current position = Current Position (new position)

Does that make any sense?

It’s not instant but it still works.

Also, there might be someone else out there that can give you a better solution. I just don’t know one. It might have something to do with some custom JavaScript code or something.

Want to learn more for free? 👨🏻‍💻

Subscribe to my free tutorials at the
:clock4: NoCodeMinute on YouTube :grin:



How do you differentiate current and previous positions? How do I tell bubble to calculate previous position?

I think that also you can use only one state with current position and a flow that will trigger each time current scrolling position is < position state

Send the position that was in the current position to the previous position before you save the new current position.

1 Like

I actually did this in a test app before, I just found it. Here you go:


Want to learn more for free? 👨🏻‍💻

Subscribe to my free tutorials at the
:clock4: NoCodeMinute on YouTube :grin:



What do you mean by position state?

@J805 solution works but it continuously runs that workflow making my Bubble rates go up!

@cdorozco16 Those set custom-state workflows should be client-side only. So it shouldn’t count towards your Bubble server workflow runs.

They dont count towards Bubble server workflow runs even if they look like this?

You can lessen it to every 1.0 second if you want instead of 0.1 seconds or try researching some JavaScript function that might help. :slightly_smiling_face:

This was useful, thanks.

Tweaked it a bit for what I believe is a simpler way to make it work (2 steps, 1 state)


Here’s that JavaScript :slight_smile:

$(function () {

// show hide subnav depending on scroll direction
var position = $(window).scrollTop();

$(window).scroll(function () {
    var scroll = $(window).scrollTop();

    if (scroll > position) {

        //only piece that matters
        	.stop(true, false)
                'padding': '0'
            }, 'slow')

        // scrolling downwards, only here for dev purposes
        console.log('moving DOWN the page');

    } else {
        //only piece that matters
            .stop(true, false)
                'padding': '40px 0'
            }, 'slow')

        // scrolling upwards 
        console.log('moving UP the page');

    position = scroll;


Needs a little tweaking but should get you on your way if you want to eliminate a workflow running x seconds


I’m working on creating a reusable element with 2 states that will display a simple yes/no on scroll up/down.
Right now it outputs to console only, should be done today or later this weekend.
You can simply copy the reusable element and then use the scroll up/down states to make the header disappear reappear.

Viewable Editor:

1 Like

Hey @varshneyandson, I love your approach! However, is it just me or the blue header doesn’t show up when you scroll up? It only reappears when page scrolling position = 0.

just following up to see how your app is coming along. the desired effect is possible with a plugin i’ve made. kept it private for now as i don’t want to get stuck supporting it, but you are free to try it out. i will however ,need your app name so the plugin can authorize it. then the plugin will appear in your plugins directory.

once you install the plugin, follow these instructions:

  1. Go to Settings, General, General Appearance
    :: Expose the option to add an ID attribute to HTML elements [✓]
  2. Add HideMenuOnScroll element to page (-1, -1)
  3. Create a Floating Group (0,0), Width: 684 Height: 90, Style: Blank, Background style: None
    :: ID Attribute [ b2b-header]
  4. Go to Conditional Tab of the Floating Group:
    :: When HideMenuOnScroll A’s hide on scroll is “no”
    :: This element is visible [✓]
  5. Create a Group within the Floating Group (style Group appropriately, back ground color etc.)
    :: Collapse this element’s height when hidden [✓]
    :: Animate the collapse operation [✓]
    :: Animation style [ Fade In/Out ]
  6. Go to Conditional Tab of the Group
    :: When HideMenuOnScroll A’s hide on scroll is “yes” and Current page width ≤ 1024
    :: This element is visible [ ]
  7. Add Text within Group as Appropriate
1 Like

This is easily done without states.

See the video for details

In the video, they are changing the background colour, but you can change anything including whether the group is visible.

1 Like

Hello, please can I get the plugin?

Thank you.

Please post your app name here or dm me and I’ll add it. :+1: