-
-
Save amiel/396696 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>Equal Heights Test</title> | |
<style type="text/css" media="screen"> | |
#container{ width: 960px; margin: 20px auto; } | |
#foo, #bar{ float: left; margin: 10px; width: 456px; background: #eee; border: 1px solid #333; } | |
</style> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script> | |
<script src="matchHeights.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(document).ready(function() { | |
$('#foo, #bar').matchHeights(); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="container" class="we arnt going to use this"> | |
<div id="foo"> | |
<p>bar</p> | |
</div> | |
<div id="bar"> | |
<ul> | |
<li>A</li> | |
<li>Taller</li> | |
<li>Div</li> | |
</ul> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.matchHeights = function(px) { | |
var currentTallest = 0; | |
$(this).each(function(i){ | |
if ($(this).height() > currentTallest) currentTallest = $(this).height(); | |
}); | |
if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); } | |
$(this).css({'min-height': currentTallest}); | |
return this; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment