Site logo

Archived topic

Sticky Menu is not working.

17 replies · Started by Jusung on March 30, 2023

Viewing posts 1–15 of 18

I am trying to use stiky menu but it is not working.

My menu is a little bit complicated.

I have primary menu and secondary meny on desktop.
On mobile, I hide those 2 menu and show off canvas menu.

I just set the sticky menu on, but it is not working.

Can I just show the same menu as the sticky menu?

Hi Jusung,

Your sticky menu is working, but as your navigation HTML structure is a bit different, it's not working well.

Try adding this CSS:

nav#sticky-navigation {
    height: 50px;
    display: flex;
}

Can I have the same sticky menu with the original one?

Like, I can't see the secondary menu.

The Sticky menu is working for me on Desktop view. To clarify, are you wanting it to work on Mobile as well?

Do you want the Secondary menu to be sticky as well?

Yes. It should work on mobile as well.
Also, there should be secondary menu on the sticky menu.

Primary menu on right side and secondray menu on left side.

Do you already have it set to On on Appearance > Customize > Layout > Sticky Navigation?

Yes. It is on and I just added this code.
nav#sticky-navigation {
height: 50px;
display: flex;
}

It's not working from my end. Is it working from your end?

Sorry. I don't understand.

I can only see primary menu on the center.
I want to see primary and secondary menu there.

This is what I see and this is way different from my menu.

I see. If that's what you're looking for, you'll need to hook the Secondary Nav generate_inside_navigation.

Create a Hook Element with this code:

<?php
if (function_exists('has_nav_menu') && has_nav_menu('secondary')) {
	generate_secondary_navigation_position();
} 
?>

Hook it to generate_inside_navigation.

It works. It makes the secondary menu on sticky menu.

However, it also make another secondary menu on original menu.
So, there are 2 secondary menu on original menu..

Is there a way to make this by adding CSS?

Hi there,

why not use a single navigation on mobile ?
We can style the first lot of menu items differently using CSS.

I don't understand.

I am just trying to make stikcy menu.
The mobile menu has to be off canvas so that I can include all the menu I want.

The reason stikcy menu not working is beacause of off canvas menu..?

This archived topic is closed to new replies.