Flexible Content Expanding Collapsing Plugin jQuery Collapse - Free Download Flexible Content Expanding and Collapsing Plugin - jQuery Collapse

Free Download Flexible Content Expanding and Collapsing Plugin – jQuery Collapse

Posted on

This time I will share jQuery Plugin and tutorial about Flexible Content Expanding and Collapsing Plugin – jQuery Collapse, hope it will help you in programming stack.

Flexible Content Expanding Collapsing Plugin jQuery Collapse - Free Download Flexible Content Expanding and Collapsing Plugin - jQuery Collapse
File Size: 96.9 KB
Views Total: 7756
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Collapse is a simple, lightweight and flexible jQuery Plugin that allows you to expand or collapse content to save space and reduce the load time.

Features:

  • Accordion Behaviour Supported.
  • Works with CSS3 Animations.
  • Remembers the toggle state on page reload using local storage or cookies.
  • Compatible with all major browsers.

Basic Usage:

1. Include jQuery and jQuery Collapse in your page.

1 <!-- Required -->
2 <script src="jquery.min.js"></script>
3 <!-- Core -->
4 <script src="src/jquery.collapse.js"></script>
5 <!-- Cookies -->
6 <script src="src/jquery.collapse_cookie_storage.js"></script>
7 <!-- Local Storage -->
8 <script src="src/jquery.collapse_storage.js"></script>

2. Create trigger elements and toggleable content into a container with the data-collapse attribute. That’s it.

01 <div id="demo" data-collapse>
02   <h2>Fruits</h2>
03   <ul>
04     <li>Apple</li>
05     <li>Pear</li>
06     <li>Orange</li>
07   </ul>
08   <h2>Info</h2>
09   <div>
10     <p>You can use any container you like (in this case a div element)</p>
11   </div>
12 </div>

3. Enable the Accordion mode.

1 <div id="demo" data-collapse="accordion">
2   ...
3 </div>

4. Persist the toggle state.

1 <div id="demo" data-collapse="persist">
2   ...
3 </div>

5. You can also initialize the plugin via JavaScript as follows:

1 $(".demo").collapse({
2  
3   accordion: false,
4   persist: false
5  
6 });

6. Callback functions which will be fired on open/close.

01 $(".demo").collapse({
02  
03   open: function() {
04     // do something
05   },
06   close: function() {
07     // do something
08   }
09  
10 });

Changelog:

2020-02-04


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

source : jquery.net