Responsive Folder Tree Plugin with jQuery Bonsai - Download Responsive Folder Tree Plugin with jQuery - Bonsai

Download Responsive Folder Tree Plugin with jQuery – Bonsai

Posted on

This time I will share jQuery Plugin and tutorial about Responsive Folder Tree Plugin with jQuery – Bonsai, hope it will help you in programming stack.

Responsive Folder Tree Plugin with jQuery Bonsai - Download Responsive Folder Tree Plugin with jQuery - Bonsai
File Size: 431 KB
Views Total: 7543
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   



Bonsai is a very small (~3kb minified) jQuery plugin which turns a normal nested list into a responsive, mobile-friendly, collapsible, hierarchical folder tree. The plugin uses Font Awesome icon font for folder / file / arrow icons.

How to use it:

1. Download Bonsai plugin and include the bonsai.css and bonsai.js into your document which has jQuery library installed.

1 <link rel="stylesheet" href="/path/to/bonsai.css">
2 <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
3 <script src="/path/to/bonsai.min.js"></script>

2. Create a folder tree from the html structure like this:

01 <div class="bonsai">
02   <ul class="section">
03     <li class="folder">
04       <a class="" href="">
05         <i class="icon-caret-right"></i>
06         <i class="icon-doctype icon-columns"></i>
07         Templates
08         <i class="icon-chevron-sign-right"></i>
09       </a>
10       <ul class="section">
11         <li class="folder">
12           <a class="" href="">
13             <i class="icon-caret-right"></i>
14             <i class="icon-folder icon-doctype icon-folder-close"></i>
15             Global
16             <i class="icon-chevron-sign-right"></i>
17           </a>
18           <ul class="section">
19             <li>
20               <a href="">
21                 <i class="icon-filetype icon-doctype icon-columns"></i>
22                 Blog Post
23                 <i class="icon-chevron-sign-right"></i>
24               </a></li>
25             <li>
26               <a href="">
27                 <i class="icon-filetype icon-doctype icon-columns"></i>
28                 Default Template
29                 <i class="icon-chevron-sign-right"></i>
30               </a>
31             </li>
32           </ul>
33         </li>
34       </ul>
35     </li>
36   </ul>
37 </div>

3. Create a new Bonsai instance.

1 var mytree = new $.bonsai($('.bonsai'));

4. Default plugin options.

1 // hierarchical data your want to present in the folder tree
2 data:[],
3  
4 // CSS selectors
5 folderClass:'folder',
6 folderIconClass:'icon-folder',
7 folderIconOpenClass:'icon-folder-open',
8 folderIconCloseClass:'icon-folder-close'

This awesome jQuery plugin is developed by jpdevries. For more Advanced Usages, please check the demo page or visit the official website.




source : jqueryscript.net