Hamburger (Nav Toggle Menu)

@wolfganghofer posted this:
When I click on a menu item on the iPhone, the navigation panel does not close automatically. I have to click on the hamburger icon again to do this. This is a bit inconvenient.

Can anyone tell me how to solve the problem?

1 Like

Hi @Grandpa

You could solve this by adding a couple of custom attributes to the menu items. This issue is happening because you are using scroll too.

You need 2 attributes per menu item thats scrolling on the same page. I got the navbar class from your site, so it should work fine.

data-toggle="collapse"

and

data-target=".navbar-41601"

Screen Shot 2021-10-07 at 12.15.07 PM

3 Likes

By the way, if you update your site to Bootstrap 5 these attribute names change slightly to…

data-bs-toggle="collapse"

and

data-bs-target=".navbar-41601"

Maybe we can ask @Norm to include this in the Scroll to option so it automatically collapses the navigation.

The only thing, is you dont always use it just in the navbar.

2 Likes

Hi @PeteSharp, yes yes yes … I think, everything is fine. Thanks a lot. :smiley:

I’m soo happy.

1 Like

Hello,

a new website … the old problem with the Hamburger menu

Hamburger Menu works … but don’t closes automatically and when I add attributes (data-bs-toggle="collapse" and data-bs-target=".navbar-17063") to the menu items, the Hamburger Menu doesn’t work at all

You might have to change the target to match your navbar.

Hello Pete,

you mean the “17063”? Where can I find the correct one?

You have it correct.

But I can’t see those attributes on any of the links you are using scroll to on.

After it didn’t work, I deleted them:

Is there a collision between row 31 and 39?

Row 31 & 39 ? Not sure I follow.

Sorry, I mean the Source Code from the page.

Looks correct to me.

Now, I added the attributes to the first 3 menu items … the Hamburger Menu closes automatically, but the link to the target isn’t working.

Something must have changed in the Blocs code, which prevents it ?

By the way, this works automatically in Offcanvas Helper :joy:

1 Like

So, I have to take off the Menu complete and than I’ll install it new.

Then I invest in the Offcanvas Helper. :wink:

Thanks for support.

1 Like

Usually the attributes work, as they are part of the Bootstrap system, you can prevent them working with javascript though, so maybe something in the blocs javascript for the menu toggle is doing that.

:man_shrugging: