I wan’t to do what techcrunch.com 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.
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.
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 NoCodeMinute on YouTube
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
$(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
$('input')
.stop(true, false)
.animate({
'padding': '0'
}, 'slow')
.removeClass('up')
.addClass('down');
// scrolling downwards, only here for dev purposes
console.log('moving DOWN the page');
$('input').val('down');
} else {
//only piece that matters
$('input')
.stop(true, false)
.animate({
'padding': '40px 0'
}, 'slow')
.removeClass('down')
.addClass('up');
// scrolling upwards
console.log('moving UP the page');
$('input').val('up');
}
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.
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:
Go to Settings, General, General Appearance
:: Expose the option to add an ID attribute to HTML elements [✓]
Add HideMenuOnScroll element to page (-1, -1)
Create a Floating Group (0,0), Width: 684 Height: 90, Style: Blank, Background style: None
:: ID Attribute [ b2b-header]
Go to Conditional Tab of the Floating Group:
:: When HideMenuOnScroll A’s hide on scroll is “no”
:: This element is visible [✓]
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 ]
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 [ ]