Greetings friends. I am trying to figure out a way to code a group of horizontal buttons which will be linked to anchors on the page. However, since this horizontal menu will be near the top of the page, once someone clicks a button and is taken to the anchor connected to that button, I don’t want the anchor menu to be left at the top. I would like it to “stick” to the top of the page once the initial scroll takes place so that the visitor has the menu available on the page no matter where they have scrolled.
If and once they scroll back up and the menu comes back into vision (i think it’s called viewport), the menu “unsticks” from the top of the page and goes back to normal. I am not sure if I am able to explain it properly but here is a link to a site and if you click on the anchor buttons, eg. Quote, and the page scrolls down to that anchor, the anchor menu automatically sticks to the top of the page.
Hi,
it’s possible to achieve what you have described combining default Wix features and coding:
Add the menu created of buttons or whatever elements you wish.
Duplicate it.
Pin one to the top of the site and make it hidden on load (through element’s properties ).
Place the other element on the site where you wish it to be and remember its position (y position on the right toolbar).
Then using wix-window API you can add code which will check the position of the window and when it’s below the position of the element, make the pinned element visible .
Add code which makes the pinned element hidden when you scroll above your menu element.
Hi, I’m trying to do a similar thing myself… having a main feature homepage with a “header” (menu) that appears when the user has scrolled beyond the feature.
I’m new to this so not entirely sure how to puece certain functions together…
Would it be possible to get an example of how it should all look in the code?