PHPackages                             lavoiesl/jquery-autocollapser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lavoiesl/jquery-autocollapser

AbandonedArchivedJquery-plugin[Utility &amp; Helpers](/categories/utility)

lavoiesl/jquery-autocollapser
=============================

Small jQuery plugin that collapses a box on a toggle

48JavaScript

Since Mar 7Pushed 14y agoCompare

[ Source](https://github.com/lavoiesl/Jquery-AutoCollapser)[ Packagist](https://packagist.org/packages/lavoiesl/jquery-autocollapser)[ RSS](/packages/lavoiesl-jquery-autocollapser/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

jQuery AutoCollapser
====================

[](#jquery-autocollapser)

Author
------

[](#author)

Sébastien Lavoie ()

Description
-----------

[](#description)

Simple solution to a common problem:

- Easy binding for the toggle of collasped/expanded of a selector
- Provides an API to show/hide/toggle
- Adds classes collapse-{expanded,collapsed} on the wrapper

Much can be done, but this is the first version

Prerequisites
-------------

[](#prerequisites)

- jQuery, should work with any version but tested with 1.7

Basic setup
-----------

[](#basic-setup)

```

      Toggle

          Test
          Test
          Test
          Test

```

Initialization
--------------

[](#initialization)

```
$(function() {
    $('.collapse-wrapper').autoCollapser();
});
```

### Options

[](#options)

```
{
    box: '.collapse-box',                 // The box that will be collasped
    toggle: '.collapse-toggle',           // The trigger, binding will be added onClick
    collapsedClass: 'collapse-collapsed', // Class to be added to the wrapper when it is collapsed
    expandedClass: 'collapse-expanded',   // Idem
    duration: 800,                        // Speed in ms for the animation,
    stop: true                            // Empty the queue using .stop(true, true)
}
```

CSS Example
-----------

[](#css-example)

```
.collapse-wrapper {
    border: 1px solid green;
    padding: 10px;
    margin: 10px;
}

.collapse-expanded .collapse-toggle::after {
    content: " -"
}
.collapse-collapsed .collapse-toggle::after {
    content: " +"
}

.collapse-box {
    border: 1px solid red;
    margin: 10px;
}
```

API
---

[](#api)

```
$('.collapse-wrapper').autoCollapser('show');
$('.collapse-wrapper').autoCollapser('hide');
$('.collapse-wrapper').autoCollapser('toggle');
```

### Events

[](#events)

Two events are made and they both pass the data.show as a boolean

- autoCollapser.toggle.start
- autoCollapser.toggle.after

```
$('.collapse-wrapper').on('autoCollapser.toggle.start', function(event,data){
  console.log("Collapser has started " + (data.show ? 'expanding' : 'collasping'));
});
$('.collapse-wrapper').on('autoCollapser.toggle.after', function(event,data){
  console.log("Collapser was " + (data.show ? 'expanded' : 'collasped'));
});
```

Demo
----

[](#demo)

Checkout the [demo](http://lavoiesl.github.com/Jquery-AutoCollapser/demo.html)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec3a0e0db3f9c250563b821407537b24bd3304c8bb3379c017d8ca4743b7b15c?d=identicon)[lavoiesl](/maintainers/lavoiesl)

---

Top Contributors

[![lavoiesl](https://avatars.githubusercontent.com/u/1216046?v=4)](https://github.com/lavoiesl "lavoiesl (28 commits)")

### Embed Badge

![Health badge](/badges/lavoiesl-jquery-autocollapser/health.svg)

```
[![Health](https://phpackages.com/badges/lavoiesl-jquery-autocollapser/health.svg)](https://phpackages.com/packages/lavoiesl-jquery-autocollapser)
```

###  Alternatives

[mpociot/reflection-docblock

8515.6M51](/packages/mpociot-reflection-docblock)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
