jQuery(document).ready(function($){
/* Put any theme-specific JS here... */
var $components = $('#content > .inner, .fixed-sidebar .fixed-sidebar-inner');
function equalizeHeights($selector) {
var heights = new Array();
// Loop to get all element heights
$selector.each(function() {
var $this = $(this);
// Need to let sizes be whatever they want so no overflow on resize
$this.css('min-height', '0');
$this.css('max-height', 'none');
$this.css('height', 'auto');
// Then add size (no units) to array
heights.push($this.innerHeight());
});
// Find max height of all elements
var max = Math.max.apply( Math, heights );
// Set all heights to max height
$selector.each(function() {
if($(window).width() > 768) {
$(this).css('min-height', max + 'px');
}
});
}
$(window).load(function() {
// Fix heights on page load
equalizeHeights($components);
// Fix heights on window resize
var iv = null;
$(window).resize(function() {
if(iv !== null) {
window.clearTimeout(iv);
}
// Needs to be a timeout function so it doesn't fire every ms of resize
iv = setTimeout(function() {
equalizeHeights($components);
}, 120);
});
});
});