jQuery.equalize

by eustasy Labs


jQuery.equalize is a small jQuery plugin to equalize the height of elements with the equalize class within groups, or the entire page. It is open-sourced by eustasy under the MIT License, and the minified version is less than 1 KB in size. That's small enough to inline into each page you want it on, or add it in to any existing script files. You might want to take a look at the unminified version if you want to understand what it is doing.

It looks something like this:

CDN Delivery GitHub

v.1.8  ·  Zip  ·  6 KB

This Bit

is unequalized

I can add loads of content here and make loads of whitespace to the right.

Color theory encompasses a multitude of definitions, concepts and design applications - enough to fill several encyclopedias. However, there are three basic categories of color theory that are logical and useful : The color wheel, color harmony, and the context of how colors are used.

Color theories create a logical structure for color. For example, if we have an assortment of fruits and vegetables, we can organize them by color and place them on a circle that shows the colors in relation to each other.

See how

messy this looks?

almost like

I was trying to give a designer a headache of magnificent proportions.

The kind that makes you hallucinate about riding a donkey at the beach, and the maw of a gigantic scorpion surfacing through the sand towards you, moving past to terrorise Blackpool.

Oh, wait, that was a Primeval episode.


These columns are equalized

Everything looks neater and easier to understand.

Color theory encompasses a multitude of definitions, concepts and design applications - enough to fill several encyclopedias. However, there are three basic categories of color theory that are logical and useful : The color wheel, color harmony, and the context of how colors are used.

Color theories create a logical structure for color. For example, if we have an assortment of fruits and vegetables, we can organize them by color and place them on a circle that shows the colors in relation to each other.

See how

much better this looks?

All of this was achieved by adding the equalize class within a group class.

Designers Everywhere

Will rejoice as things are pixel perfect.

The kind that makes you hallucinate about riding a donkey at the beach, and the maw of a gigantic scorpion surfacing through the sand towards you, moving past to terrorism Blackpool.

Oh, wait, that was a Primeval episode.

Tip: Try re-sizing the window!


The Syntax

The syntax of jQuery.equalize is ridiculously simple, it uses the group class that is already utilized in many bootstraps, templates and boilerplates, and the equalize class to detect what elements it should be targeting. Don't forget to include a nice, recent version of jQuery and your copy of jQuery.equalize, or you can load it from Git (it's not on any CDNs i know of yet).


Nested Items

The equalized divs don't need to be directly below the group div, in fact, they don't even need to be divs. Anything that can have the height set via CSS will work fine. Note that it doesn't take padding into account, so that's up to you to handle how you will, either keeping them all the same or adding a div specifically for padding.


What Not To Do, Sort Of

Here, there is a group within another group. This is actually okay, so long as you don't mind the equalized divs inside the second group expanding to match the first group, which they are technically a part of too.


Custom Classes

Custom group and equalize classes can be passed quickly and simply without modifying the source files and breaking your upgradability.


Responsive CSS

This example shows a small snippet of CSS designed to force height back to automatic when the screen width is smaller than a set amount. This stops large empty spaces appearing on mobile devices. You can modify the width and any other variables to suit your needs.

 


jQuery.equalize

CDN Delivery GitHub

v.1.8  ·  Zip  ·  6 KB