json accordion nav bootstrap - Free Download Dynamic JSON Accordion Menu For Bootstrap - jQuery JSONmenu

Free Download Dynamic JSON Accordion Menu For Bootstrap – jQuery JSONmenu

Posted on

This time I will share jQuery Plugin and tutorial about Dynamic JSON Accordion Menu For Bootstrap – jQuery JSONmenu, hope it will help you in programming stack.

json accordion nav bootstrap - Free Download Dynamic JSON Accordion Menu For Bootstrap - jQuery JSONmenu
File Size: 5.59 KB
Views Total: 538
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A JSON based menu builder plugin that enables developers to dynamically creates an accordion-style vertical menu using jQuery and Bootstrap 4 list component.

How to use it:

1. The JSON Menu plugin requires jQuery library and Bootstrap 4 framework to work.

1 <link rel="stylesheet" href="/path/to/cdn/bootstrap.min.css" />
2 <script src="/path/to/cdn/jquery.slim.min.js"></script>
3 <script src="/path/to/cdn/bootstrap.min.js"></script>

2. Create a basic accordion menu from a JavaScript array of objects as follows:

01 $("#myMenu").jsonMenu("set", {
02   body:[{
03     header:"<strong>Header</strong>",
04     body:"Body",
05     collapse:true
06   },{
07     header:"Aanother header",
08     body:"This body supports <a href='https://google.com'>HTML CODE</a>.",
09     footer:"<hr/> Menu Body Here",
10     collapse:false
11   }]
12 });

3. It also works with JSON data by using the JSON.parse() and JSON.stringify() methods.

4. Add header & footer to the accordion menu.

01 $("#myMenu").jsonMenu("set", {
02   header: 'Header Here',
03   body:[{
04     header:"<strong>Header</strong>",
05     body:"Body",
06     collapse:true
07   },{
08     header:"Aanother header",
09     body:"This body supports <a href='https://google.com'>HTML CODE</a>.",
10     footer:"<hr/> Menu Body Here",
11     collapse:false
12   }],
13   footer:"Footer Here"
14 });

5. Add new items to the accordion menu.

01 $("#myMenu").jsonMenu("add", {
02   header: 'New Header Here',
03   body:[{
04     header:"<strong>Header</strong>",
05     body:"Body",
06     collapse:true
07   },{
08     header:"Aanother header",
09     body:"This body supports <a href='https://google.com'>HTML CODE</a>.",
10     footer:"<hr/> Menu Body Here",
11     collapse:false
12   }],
13   footer:"New Footer Here"
14 });

6. Show & hide the menu items manually.

1 $("#myMenu").jsonMenu("show");
2 $("#myMenu").jsonMenu("hide");

7. Remove & clear the menu items manually.

1 $("#myMenu").jsonMenu("remove");
2 $("#myMenu").jsonMenu("clear");