npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eqcol

v2.0.0

Published

Equal effing columns

Downloads

16

Readme

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.

| 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 |

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

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

License

MIT © Alex Cross