Okay
  Public Ticket #2684109
use menu for onepage
Closed

Comments

  • pi-pages started the conversation

    hi there,

    i am using your nice theme for a one page laoyut.

    i tried to link the menu items to an section of the one page. actually the links work (e.g. https://www.fraublumenschoen.de/#kontakt) - but the menu does not disappear after clicking at the links.

    how can i change this?

    best 

    thomas

  •  241
    Elena replied

    Hello Thomas,

    Unfortunately the menu was not designed for a "scroll-to" functionality. Every time you click on a menu link, you are supposed to visit a different page, and menu will be return to the initial state, i.e. "closed". In your case, you want to close the menu when a menu link is clicked, so you'd need to add some extra JS that closes the menu on click.

    Unfortunately we are unable to provide full support on theme customisations, I am sorry, but here is a tip: you could activate the child theme, and enqueue a new JS file (for example: https://wordpress.stackexchange.com/questions/306604/adding-javascript-to-child-theme). Then, inside the JS file you should probably define a new manu behaviour when clicking on a menu link.

    Best, P.

  • pi-pages replied

    hello pasquale,

    well i found the much easier way was to tweak line 122 of the /hemma/js/main.js which is responsible to leave the menu whenever you click anywhere but the side menu - i simply turned this behaviour around by deleting the "!" in the line of code.

    maybe you could be so kind of letting me know how to overwrite this file with the child theme.
    i put it to /hemma-child/js/main.js but it would not get read.

    all my best
    thomas

  •  241
    Elena replied

    Hey Thomas,

    Sure it works, but keep in mind that you will lose any changes to the main theme in case you will need to update it.

    Best, P.

  • pi-pages replied

    hey pasqual,

    thats exactly the reason why i was asking you to instruct me a way to put it in the child theme.
    it seems a bit you avoiding work today - maybe it's snowing at your place too ;-)
    best
    thomas

  •  241
    Elena replied

    Hello again Thomas,

    I see your point but, as I previously wrote I am unable to provide full support on theme customisations. It's not a matter of avoiding work, but while editing the parent file requires a minimal change, creating a child theme requires much more work. 

    With that being said, any new JS file that you are going to add into a child theme needs to be "enqueued" in via the functions.php file that comes with the child theme, as showed in the link I previously attached: https://wordpress.stackexchange.com/questions/306604/adding-javascript-to-child-theme

    Then you are supposed to add some JS in that file that triggers the menu closing when clicking on a menu link. Hope that makes sensesmile.png

    Best, P- 

  • pi-pages replied

    thanks and please mark as solved.