And it is actually working fine exept for one small thing. When you click on a link that has a submenu it is executed right. But if by accident you click on the same link again the entire slideUp/slideDown event is executed again. I tried the one time event .one():
Click on “Voorgerechten”, and the submenu is rolling out.
Then click again on “Voorgerechten”, then the submenu is rolling in first, and back out immediately afterwards.
I think there has to be added a toggling if/else statement to see if the submenu is visible or not. If not visible > open submenu, else > close submenu.
How to do in jQuery … don’t know, but Pullo or some other will have the simple code for that, I guess.
Note: I should start with the complete Menu’s, and then the “losse Gerechten” (loose Dishes). Are there no “Desserts”? Or a “Drankenkaart” (Drinks menu), to be complete?
Hahahahaha. Thank you Paul. This is nearly what I am looking for! It just slide up again when clicking the parent again and not down again. But I am looking for away that it isn’t sliding at all when the parent is clicked again while the sub is open!
Hi Pullo. That is indeed what I was looking for. It all seems so simple when you see it. I was struggling for hours. Thanks to Paul I was a step nearer and now It is like I would like to. So thanks again. Also thanks to Paul and Francky
Bear in mind what Paul said with the default accordion behaviour, however.
I often do the same thing (i.e. shut it, to stop it taking up space, especially if viewing on a small screen).
Would it really hurt to offer this to your users?