# eqcol

> Equal effing columns

Latest version **2.0.0** (published 2016-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install eqcol
pnpm add eqcol
yarn add eqcol
bun add eqcol
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2016-12-19 |
| First published | 2016-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alex Cross |
| Maintainers | awcross |
| Keywords | equal, columns, row, height, browser, bootstrap, foundation, match |

## Links

- npm: https://www.npmjs.com/package/eqcol
- Repository: https://github.com/awcross/eqcol
- Homepage: https://github.com/awcross/eqcol#readme
- Issues: https://github.com/awcross/eqcol/issues
- npm.io page: https://npm.io/package/eqcol

## Dependencies (2)

- [customevent](https://npm.io/package/customevent.md) ^1.0.0
- [elem-dataset](https://npm.io/package/elem-dataset.md) ^1.1.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2016-12-19
- 1.2.2 — 2016-10-07
- 1.2.1 — 2016-09-30
- 1.2.0 — 2016-09-27
- 1.1.0 — 2016-09-24
- 1.0.0 — 2016-09-23
- 0.0.0 — 2016-09-23

## README

# eqcol

> Equal effing columns


## Install

Browserify

```
$ npm install --save eqcol
```

Bower

```
$ bower install --save eqcol
```

```html
<script src="bower_components/eqcol/dist/eqcol.min.js"></script>
```


## Usage

#### Basic usage

```html
<div class="row" data-eqcol>
	<div class="col-md-4" data-eqcol-watch>
		...
	</div>
	<div class="col-md-4" data-eqcol-watch>
		...
	</div>
	<div class="col-md-4" data-eqcol-watch>
		...
	</div>
</div>
```

```js
import eqcol from 'eqcol';

const row = document.querySelector('.row');
eqcol(row, {
	// options...
});
```

#### Nesting

```html
<div class="row" data-eqcol="foo">
	<div class="col-md-4" data-eqcol-watch="foo">
		...
	</div>
	<div class="col-md-4" data-eqcol-watch="foo">
		<div class="row" data-eqcol="bar">
			<div class="col-sm-6" data-eqcol-watch="bar">
				...
			</div>
			<div class="col-sm-6" data-eqcol-watch="bar">
				...
			</div>
		</div>
	</div>
	<div class="col-md-4" data-eqcol-watch="foo">
		...
	</div>
</div>
```

```js
import eqcol from 'eqcol';

const rows = document.querySelectorAll('.row');
eqcol(rows, {
	// options...
});
```


### API

#### eqcol(element [, options])

Initializes and equalizes the specified element(s). Returns an array of `Eqcol` objects.

##### element

Type: `string` || `Element` || `NodeList`

The container of the element(s) to be equalized. For instance, the parent row of the targeted columns.

##### options

Type: `object`

Optionally pass an object with the any of the following values.

| Name       | Type    | Default          | Description                                                |
|:-----------|:--------|:-----------------|:-----------------------------------------------------------|
| byRow      | boolean | true             | Matches each rows' child elements height only              |
| minHeight  | integer | 0                | The minimum height of each column                          |
| useTallest | boolean | true             | Whether to use the tallest column as height of all columns |
| groupAttr  | string  | data-eqcol       | Passed a unique ID of each container                       |
| watchAttr  | string  | data-eqcol-watch | Passed the value of its matching unique parent ID          |


### Methods

###### `eqcol(element, 'equalize')`

Call the `equalize` function directly.

###### `eqcol(element, 'destroy')`

Reset all of the columns back to `auto` height.


### Events

There are two events that are exposed.

| Name    | Description                                  |
|:--------|:---------------------------------------------|
| equal   | Fired right before the columns are equalized |
| equaled | Fired after the columns are equalized        |

```js
const rows = eqcol('.row', options);

rows.forEach(row => {
	row.addEventListener('equaled', () => {
		// do stuff after equalize has finished
	});
});
```

## License

MIT © [Alex Cross](https://alexcross.io)

---
_Source: https://npm.io/package/eqcol · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
