Skip to content

Instantly share code, notes, and snippets.

@jbubriski
Created March 10, 2015 19:24
Show Gist options
  • Save jbubriski/2ba5c4df43a446ba2ea3 to your computer and use it in GitHub Desktop.
Save jbubriski/2ba5c4df43a446ba2ea3 to your computer and use it in GitHub Desktop.
Make columns equal height.
var $mainNavItem = jQuery('#mainNav .two-column-nav');
jQuery($mainNavItem).on('mouseover', function () {
var mousedOver = jQuery.data(this, "mousedOver");
if (!mousedOver) {
var $this = jQuery(this);
var height = 0;
$siblings = $this.find('li.level2');
for (var i = 0; i < $siblings.length; i++) {
$sibling = $($siblings[i]);
if ( $sibling.height() > height)
height = $sibling.height();
}
for (var i = 0; i < $siblings.length; i++) {
$($siblings[i]).css('height', height + 'px');
}
jQuery.data(this, "mousedOver", true);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment