Create Smooth Collapsible Boxes Using jQuery - Box.js

File Size: 12.4 KB
Views Total: 1683
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Create Smooth Collapsible Boxes Using jQuery - Box.js

Box.js is a lightweight and easy-to-use jQuery plugin used to toggle (expand and collapse) block elements with a smooth sliding animation.

How to use it:

1. Add the jQuery box.js script and other required resources into the html page.

<link rel="stylesheet" href="box.min.css">
<script src="/path/to/jquery.min.js"></script>
<script src="dist/box.min.js"></script>

2. Create header, body and footer content for the collapsible box.

<div class="box" data-box>

  <div class="box-header" data-box-collapse-toggle>
    <span class="box-header-title box-header-title--padding">
      Header content here
    </span>
  </div>

  <div data-box-collapse-content>
    <div class="box-body box-body--padding">
      <p>
        Main content here
      </p>
    </div>

    <div class="box-footer">
      Footer content here
    </div> 
  </div>
  
</div>

3. Call the main function on the top container and the plugin will do the rest.

<script>$('[data-box]').box();</script>

Change log:

2016-11-24

  • Added class to enable horizontal scroll
  • Fixed scroll class

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