

Equalize.js now equalizes height or width of child elements - tsvensen
https://github.com/tsvensen/equalize.js

======
ryanashcraft
I've found the best way of equalizing heights/widths is just using
display:table/table-row/table-cell. It handles resizing (responsiveness) and
doesn't require any JavaScript.

~~~
rquantz
So you're back to your layout being entirely dependent on your markup? wasn't
this what CSS layouts were supposed to get away from?

~~~
Osiris
As opposed to your layout being entirely dependent on JavaScript? I'm not sure
I see the difference between requiring JavaScript code to manipulate the
layout versus using CSS to do the same. Why is one better/worse than the
other?

------
b3tta
_sigh_... Yet another simple plugin which needs jQuery for something which
could be done in vanilla JS and still need less LOC.

Tim: A better approach would be to iterate through all children and find the
maximum using elem.offset(Height|Width).

Then create a new <style> in the head for your plugin if it doesn't exist and
append a new rule like:

    
    
      style.innerHTML += '#' + (elem.id || (elem.id = 'eq' + (Date.now() % 1e9))) + '>*{' + equalize + ':' + val + '}';
    

If you don't like this you could still use elem.style.(width|height) (and
maybe even detach the container beforehand to prevent unnecessary reflows),
which will be faster and doesn't require a 90KB lib.

~~~
tsvensen
Good call on a non-js version, this was abstracted from some code for a larger
project. When I find the time I'll update the repo with a branch for a non-
jQuery version, but there are plenty of simple scripts out there.

Also, jQuery is 32KB minified and gzip'd AND that's if it's not already
cached. Using the Google CDN helps as well, chances are you may not even be
downloading it. Not looking to get into a jQuery vs. js debate.

"I don't always write jQuery, but when I do, I use Javascript"

~~~
b3tta
I know that. In fact I use jQuery in almost every website I'm writing, because
I need backwards compatibility with older browsers. But since I started
working on a certain website which only supports IE9, I'm pretty much only
using jQuery for $.fn.animation. I just feel like it's a huge waste of
computing time. Apart from that I think it's important to write "cross-
library" plugins.

------
indubitably
flexbox

~~~
tsvensen
Flexbox is a great solution, but only partially supported as of right now for
the latest releases of the major browsers (IE9 and below, no support):

<http://caniuse.com/#feat=flexbox>

Great article on the latest version of flexbox:
<http://github.com/doctyper/flexie>

So flexbox will work, but it is a bit unstable right now.

