Skip to content

Instantly share code, notes, and snippets.

@ashrewdmint
Created February 2, 2011 19:03
Show Gist options
  • Select an option

  • Save ashrewdmint/808183 to your computer and use it in GitHub Desktop.

Select an option

Save ashrewdmint/808183 to your computer and use it in GitHub Desktop.
$.fn.linkHeight = function(target) {
var el = $(this);
target = $(target);
var padding = parseInt(el.css('padding-top'), 10) + parseInt(el.css('padding-bottom'), 10);
function updateHeight() {
el.height('auto');
var targetHeight = target.outerHeight() - padding;
if (targetHeight > el.height()) {
el.height(targetHeight);
}
}
// Kick off
updateHeight();
// Interval + resize event
setInterval(updateHeight, 500);
target.bind('resize', updateHeight);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment