Skip to content

Instantly share code, notes, and snippets.

@greggnakamura
Forked from jbubriski/equal-height.js
Last active November 14, 2015 00:25
Show Gist options
  • Save greggnakamura/8f7bc09963e78583eda0 to your computer and use it in GitHub Desktop.
Save greggnakamura/8f7bc09963e78583eda0 to your computer and use it in GitHub Desktop.
jQuery: Equal heights custom script
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