dnamixup — 2013-12-05T06:20:44-05:00 — #1
I'm very new to javascipt/jQuery but have put together this menu
I've got it to keep the menu items open when you change page but I need the menu to stay open when you've clicked a sub-menu item as it currently closes it.
pullo — 2013-12-05T10:42:18-05:00 — #2
How are youincluing the navigation into your page?
Via PHP or is it hard-coded?
dnamixup — 2013-12-05T10:58:51-05:00 — #3
The navigation is hard coded into the page.
Is there another way to remember a navigation state? WOuld it be with css?
pullo — 2013-12-05T14:57:30-05:00 — #4
I've made you a simple example demonstrating how to do this.
You basically apply an "active" class to your active menu points and style them differently than your non-active ones.
Have a look at the source of my demo to see the code and let me know if you have any questions.
dnamixup — 2013-12-06T03:43:25-05:00 — #5
Thank you very much for the demo, it's a good piece of code to work from!
So the jQuery is just running the menu animations?
Would it be possible to keep the menu open say when I click Page 1?
pullo — 2013-12-06T03:55:17-05:00 — #6
HTTP is a stateless protocol, so individual web pages (and by definition the JS they execute) have no concept of an action which was taken on a previous/different page.
You can use client-side storage to persist data, but in this case, it is better to just apply a class and style accordingly.
Yes, you could add the appropriate class declaration to page 1 (look at the source code of the demo).
However, if this is something you want to do, then I would alter the class names for example "open" is better than "active".
dnamixup — 2013-12-06T04:04:53-05:00 — #7
Brilliant! You've been a great help!
I'm going to have a play around with the source code and see what I can come up with!
I'd +rep you but doesn't seem this forum uses it!
pullo — 2013-12-06T04:14:18-05:00 — #8
This has been discussed and will actually be introduced sometime in the future.
In the meantime, you could show your appreciation by voting at the end of year awards which should be going live next week.
dnamixup — 2013-12-06T04:26:33-05:00 — #9
Well I'll vote for you in the awards then