Skip to content

Instantly share code, notes, and snippets.

@CarlosLCervantes
Created March 24, 2014 20:47
Show Gist options
  • Save CarlosLCervantes/9748816 to your computer and use it in GitHub Desktop.
Save CarlosLCervantes/9748816 to your computer and use it in GitHub Desktop.
2 Column Floating Div Height Fix JS
var setColumns = function() {
if ($("div.two-col").length > 0) {
var columns = $("div.two-col > div");
var leftCol = columns.first();
var rightCol = columns.last();
var padding = parseInt(rightCol.css("padding-top").replace("px", "")) + parseInt(rightCol.css("padding-bottom").replace("px", ""));
rightCol.height(leftCol.height() - padding);
}
}
<div class="row two-col">
<div class="col-xs-6">
Mah stuff on the left
</div>
<div class="col-xs-6 contrast-box">
From the front door turn right. The lockbox is attached to the water faucet at the corner of the house. This text needs to be limited otherwise the display breaks. Maybe it can turn into a modal.
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment