megamenu-js icon indicating copy to clipboard operation
megamenu-js copied to clipboard

Best way to hide submenu after item was clicked?

Open Octopus75 opened this issue 8 years ago • 8 comments

Hi, thanks you for your great work. Actually when we click on a link of a submenu (wide screen version), if we don’t change the actual displayed page, the submenu remains displayed. What is the best way to hide parent submenu after item was clicked? I have tried such things: $(this).closest("ul").fadeToggle(0); $(this).closest("ul").hide(); $(this).closest("ul").css({"display": "none"});

But this generates inconsistency thereafter.

Many thanks for your help.

Octopus75 avatar Jul 04 '16 09:07 Octopus75

Hello , im really sorry but i dont understand what are you trying to ask me? Please explain better

marioloncarek avatar Jul 05 '16 19:07 marioloncarek

you are using megamenu on such website which is displaying pages with ajax or ajax-like technology?

marioloncarek avatar Jul 05 '16 19:07 marioloncarek

Thank you for your reply. Yes, I’m using megamenu to filter an image gallery with isotope (http://isotope.metafizzy.co/). The filter links to sort images are displayed in a submenu. When I click on a submenu filter link the image gallery is well filtered but the submenu remains displayed over the image gallery and rollout the submenu list is the only way to make it disappear. I just like to know if there is a way to automatically hide a submenu list after a click on one of its links.

Many thanks.

Octopus75 avatar Jul 06 '16 08:07 Octopus75

Im sorry for late response, i will try to fix this bug but i dont really have time to play with it at this moment

marioloncarek avatar Jul 22 '16 11:07 marioloncarek

Hello Mario, I adapted your script to hide submenus after a button click. I have certainly not done this adpatation by following best practice (so I will refrain from sharing my adpated code) but it is enough for me. Therefore no emergency. Thanks.

Octopus75 avatar Jul 24 '16 17:07 Octopus75

Hello Octopus75, I have the same problem burt I'm noch very good in Javascript. So I want to ask you to so kind and share your code with me, beause I'm a little bit under time pressure.

Thanks!

TR0N82 avatar Aug 10 '16 06:08 TR0N82

Hello TRON82, Please find attached my adapted version of the megamenu.js script. You'll have to rename it from "megamenu.txt" to "megamenu.js" (just change the file extension) because I can't join .js files.

It’s enough for my needs but I don’t know if everything will be OK for your requirements. I hope this will help. Sorry about that, but I would not have time for prospective adjustments ;-)

megamenu.txt

Octopus75 avatar Aug 10 '16 09:08 Octopus75

@Octopus75 thank you very much for your contribution to this repo!

marioloncarek avatar Aug 10 '16 11:08 marioloncarek