Show/hide part of a menu
Hey, first of all thanks for the great theme!
On my website i would like to have a menu in my sidebar that could show and hide a part of itself.
I have a menu with let’s say 30 Brands. I would like that it only shows the first 5(or another number) and display’s “show more” underneath it. When you click it it show’s the full menu with all the brands and “less” underneath it.
Actually, there are at least a couple of plugins that will handle this for you. Try searching the plugin repository for “accordion menu”. You may need to add “vertical” to that search. I’ve seen a couple of Graphene and a couple of non-Graphene sites that do this. It’s pretty cool.
What i want to do is to generate the menu instead of hardcode it, so that if a certain brand/category doesn’t have any items it stays hidden, and if i remove/add a brand/category it’s added to the menu.
So what i want to do is create a widget to get all the categories, and put them in an array. On loading the page i make a loop asking for the first x items in the array, and put a “show more” link after. When that link is clicked, we generate the rest of the categories and replace the “show more” link with a show less.
Should i use php or JQuery for this? Or a mix? Can i add this to the theme?
Most of the plugins i found are or showing all the categories, or none. Or showing the main categories and onclick the subcategories. This isn’t what i need and i couldnt find any plugin yet for doing this.
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.