Equalize Height Of An Element's Children - jQuery Uniformify

Equalize Height Of An Element's Children - jQuery Uniformify
File Size: 7.55 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Uniformify is a small, easy-to-use jQuery equal height plugin that allows dynamically set sibling elements to the same height no matter how you resize the browser window.

How to use it:

1. Assume that you have an element containing a group of child elements with different heights.

<div class="row">
  <div class="well col-sm-3">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vitae dignissim risus. Praesent nec malesuada nibh. Aliquam ante nulla, pellentesque bibendum tincidunt vel, faucibus pulvinar felis.
  </div>
  <div class="well col-sm-3">
    Duis molestie iaculis cursus. Fusce pharetra nulla nec nulla porttitor, sit amet convallis tellus dapibus. Donec dolor nunc, ornare eget facilisis rhoncus, elementum ac eros. Cras non velit elementum sem faucibus hendrerit sit amet sit amet libero. Donec non varius magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
  </div>
  <div class="well col-sm-3">
    Aenean tempor tortor purus, non sollicitudin quam porttitor condimentum. Suspendisse ultricies ex et ligula rutrum sollicitudin. Suspendisse velit urna, ultrices id leo sed, finibus ultricies massa. Fusce posuere, ex volutpat suscipit venenatis, mi nulla venenatis magna, vitae efficitur diam lacus id nunc. Aenean quis mollis dui. Integer et hendrerit tellus, sit amet lacinia metus. Donec faucibus lacinia arcu, eget dignissim odio semper posuere. Donec iaculis in metus non consequat.
  </div>
</div>

2. Import jQuery library and the jQuery Uniformify plugin's script into the document.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="jquery.uniformify.js"></script>

3. Just call the function on the top container and the plugin will do the rest.

$('.row').uniformify();

4. You're also allows to specify the selector to be affected by the plugin.

$('.row').uniformify({
  selector: '> div'
});

5. Decide whether to align content at the bottom edge.

$('.row').uniformify({
  bottom: false
});

6. API Methods.

// reset
$('.row').uniformify('reset');

// update
$('.row').uniformify('update');

Changelog:

2018-06-19

  • Add option to align at bottom edge.
  • Demo updated.

This awesome jQuery plugin is developed by castlegateit. For more Advanced Usages, please check the demo page or visit the official website.