megamenu-js
megamenu-js copied to clipboard
Best way to hide submenu after item was clicked?
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.
Hello , im really sorry but i dont understand what are you trying to ask me? Please explain better
you are using megamenu on such website which is displaying pages with ajax or ajax-like technology?
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.
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
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.
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!
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 ;-)
@Octopus75 thank you very much for your contribution to this repo!