I could create the hamburger and menu with my knowledge of css/html/js. But I was hoping for a way to use the functionality that discourse has already implemented (opening, closing, etc…).
Any suggestions on how to achieve this?
I thought maybe I would be able to extend the widget for the current navigation, change the settings, then attach it to the html I have written for my nav. But the connectors seemed to be predefined, and I wasnt sure how to connect my widget to my html. This might not be the right direction at all either…
This is slightly rough but should get you 99% of the way there when it comes to having an additional menu item with a dropdown panel. Calling this one a pizza menu . Add this to your header.html file.
Ah ok in that case you’re looking at something more like what @simon mentioned in the brand header theme component, I was attaching the action to the existing header widget… the brand header adds it to a new one. The new widget here w/ toggleHamburger:
Thank you for this code. Can you point me in the right direction on filling out the panelContents? I see some indication, but not sure how it all links together.
Bonjour ! Je sais que c’est un vieux sujet, mais c’est presque exactement ce que je cherche / essaie de faire. C’est pourquoi je poste ici (plutôt que de créer un nouveau sujet). Veuillez noter que je ne suis pas développeur, je ne sais pas comment fonctionnent les plugins et je ne sais pas écrire en JavaScript. Mais je sais copier-coller du code
Ce que j’essaie de faire, c’est ajouter une connexion à une salle de chat dans un menu déroulant. Ainsi, je veux une icône « chat », et dans le menu déroulant, il y aura un champ de saisie, un bouton de soumission et un texte d’aide / un lien vers une page d’aide.
Puis-je adapter votre code en remplaçant l’icône « couverts » par une icône « chat », comment faire cela ?
Et deuxièmement, comment puis-je insérer du code HTML à la place de l’instruction « hello world » ? (essentiellement, comment entrer du HTML là-dedans ?)
Haha, par coïncidence, je regarde exactement la même chose. Je pense que la meilleure approche consiste à rouvrir le widget du menu hamburger et à surcharger la méthode html.
Je vais unshift mon widget devant l’élément FAQ. Je n’ai pas vérifié si cela fonctionne, mais ce sera ma méthode
Voici où cela semble fonctionner :