Created
February 20, 2009 22:35
-
-
Save textarcana/67750 to your computer and use it in GitHub Desktop.
One way to ensure one column is the same height as another. Extra complex because I am using 'sliding doors' drop shadow on the columns. Appears to work in FF, IE, Opera, Chrome and Webkit but ymmv.
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
/** | |
* Equal height column hack for Favorites box | |
*/ | |
var fudgeAmt = (document.all === null ? 47 : 27); | |
var heightToMatch = $('equalHeightColumnsHack').clientHeight - fudgeAmt; | |
var shadowHeight = heightToMatch + 24; | |
var elems = {}; | |
elems.container = $$('#featured .content')[0]; | |
elems.shadow = $$('#featured .content .dropShadowHack')[0]; | |
/* Prettified the getComputedStyle wrapper a bit over what's in the repo, see http://www.quirksmode.org/dom/getstyles.html */ | |
var shadowBgLeft = (function(){ | |
if (elems.shadow.currentStyle) { | |
var sty = elems.shadow.currentStyle; | |
return sty.backgroundPositionX; | |
} else { | |
var sty = document.defaultView.getComputedStyle(elems.shadow, ''); | |
return sty.backgroundPosition.split(' ')[0]; | |
} | |
})(); | |
elems.container.style.height = heightToMatch + 'px'; | |
elems.shadow.style.height = shadowHeight + 'px'; | |
elems.shadow.style.backgroundPosition = shadowBgLeft + ' bottom'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment