• Hello, I hope you are well.

    I’m writing to you because I’d like to be able to add links in my main menu that will open a Toogle (it’s “détails” in French version).

    I have a page with several Toogle and I’d like to put the link directly to the open Toogle in my sub-menu.
    Is this possible? With a little code? But how do I target the right Toogle?

    Thank you very much for your help

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Yes it’s possible with some JavaScript or a related framework. You add a click event listener to each toggle item. When the event occurs, your script would expose or hide the submenu as appropriate. Event listeners are added to each toggle’s DOM element, so that the element’s JS object is passed to your callback (which can be referred to with keyword this). From that you could determine and operate on child elements so only the appropriate submenu would be exposed or hidden.

    While this can be done with straight JavaScript, IMO it’s easier to handle multiple toggles with jQuery. Here’s a tutorial using straight JavaScript, I’m sure you could find similar jQuery examples with a little searching. Good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Open Toogle by clicking in the menu’ is closed to new replies.