Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eqcol

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eqcol

Equal effing columns

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

eqcol

Equal effing columns

Install

Browserify

$ npm install --save eqcol

Bower

$ bower install --save eqcol
<script src="bower_components/eqcol/dist/eqcol.min.js"></script>

Usage

Basic usage
<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>
import eqcol from 'eqcol';

const row = document.querySelector('.row');
eqcol(row, {
	// options...
});
Nesting
<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>
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.

NameTypeDefaultDescription
byRowbooleantrueMatches each rows' child elements height only
minHeightinteger0The minimum height of each column
useTallestbooleantrueWhether to use the tallest column as height of all columns
groupAttrstringdata-eqcolPassed a unique ID of each container
watchAttrstringdata-eqcol-watchPassed 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.

NameDescription
equalFired right before the columns are equalized
equaledFired after the columns are equalized
const rows = eqcol('.row', options);

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

License

MIT © Alex Cross

Keywords

FAQs

Package last updated on 19 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc