marioloncarek / megamenu-js

Last responsive megamenu you'll ever need
MIT License
360 stars 115 forks source link

Best way to hide submenu after item was clicked? #6

Open Octopus75 opened 8 years ago

Octopus75 commented 8 years ago

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.

marioloncarek commented 8 years ago

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

marioloncarek commented 8 years ago

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

Octopus75 commented 8 years ago

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.

marioloncarek commented 8 years ago

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

Octopus75 commented 8 years ago

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.

TR0N82 commented 8 years ago

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!

Octopus75 commented 8 years ago

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

marioloncarek commented 8 years ago

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