Mobile menu listeners

4 replies · opened Mar 29, 2021

SsemcodistMar 29, 2021

I am bringing in the site's header and navbar with javascript so I only have to edit the menu once down. The problem I am having is that when the mobile version loads...the hamburger menu does not work. It seems as though that is due to the order the page loads vs when listeners activate.

Is there a good fix? I would rather not have to manually put the html on every page.

SsemcodistMar 29, 2021

Another thing worth noting...the page has to load at the mobile width. When the browser is resized...the menu works again.

SSemicolon WebSTAFFMar 30, 2021

Hello,

Since you are using JS to load the Menu Codes, the Menu Element is not found on document ready and thus cannot be initialized. Simply run the SEMICOLON.header.init(); Function just after the Menu Codes have been loaded via JS.

This should fix the issue. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

SsemcodistMar 30, 2021

That worked perfectly! Thank you so much!!!

SSemicolon WebSTAFFMar 30, 2021

Hello,

Very Happy to Help!

Do let us know if we can help you with anything else.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard