I apologize in advance for English.
I managed after several attempts and got a satisfactory result.
To make Sticky Header / Menu work, create a new website.
Any modifications of the existing page will cause permanent changes in the Menu on other subpages.
Possible restoration from the history of the website.
If I’m wrong, please give me another solution.
Here we go.
We create a blank page with header and footer.
The header1 header bar gives properties:
- viewportLeave
- viewportEnter
We add strip1 (color eg black) and give the properties:
We add strip2 (transparent color) and give properties:
- viewportEnter
- viewportLeave
strip1 = small bar
strip2 = large bar
We paste the logo and menu into the strip2 bar. You can add a cart.
How to make a menu everyone knows (simple or hamburger with lightbox)
We paste a small logo and menu into the strip1 bar. You can add a cart.
we set the header1 to a height of 40 px
strip1 to 40 px
(small logo must be smaller than 40 px bar height)
header1 freeze (show on all pages)
We set the color of the header1 bar to one that suits us.
You can add social links or a phone or an advertising slogan to header1.
Below we have two stripes (strip1 and strip2).
In the strip1 bar we have a small logo and menu + eg. Basket
In the strip2 bar we have a large logo and menu + eg. Basket.
strip1 stripe on header1 and let go.
You can not add strip1 to header1.
This should be moved so that strip1 is on header1.
strip2 move so that it is directly under header1 and strip1
Now in the paste section of the Page:
$w.onReady(function () {
//
});
export function strip1_viewportEnter() {
$w("#strip2").hide("FadeOut");
}
In the Site section, paste:
$w.onReady(function () {
//
});
export function header_viewportLeave() {
$w("#strip1").show("fadeIn");
}
export function strip1_viewportEnter() {
$w("#strip2").hide("fadeOut");
}
export function strip2_viewportEnter() {
$w("#strip1").hide();
}
export function strip2_viewportLeave() {
$w("#strip1").show("fadeIn");
}
export function header_viewportEnter() {
$w("#strip2").show("fadeIn");
}
In the preview, we see header1 and strip2.
The effect should be such that when you move the page down, strip2 disappears and strip1 appears in the header1 place.
If we do not see the effect, check the properties given. Sometimes they erase themselves (viewportEnter and viewportLeave).
You can add more transition effects to make the whole run smoother.
If someone finds a better solution, please give me a detailed and detailed description.
Thank you for inspiration and best regards.
Krzysztof (Chris) from Poland