...

View Full Version : setting DHTML list height



wac
12-19-2005, 11:25 PM
I'm using ul to render a scrollable list (rather than using select) and I'd like to be able to set the list height to to be able to view N items. I've tried using style="height:Nem" which seems to be off by one (close enough), but it doesn't account for things like border/padding/margin height. Is there a way to account for all this up front without the list flickering because it was rendered with one height and I have to run javascript to reset the height to something else???

P.S. I'm not using a select because it renders ontop of DIVs (yes, I know about wrapping the DIV with an IFRAME) and the border style cannot be set.

_Aerospace_Eng_
12-19-2005, 11:42 PM
I guess you could do it dynamically

document.getElementById('yourmenu').style.height=document.getElementById('yourmenu').offsetHeight;

wac
12-19-2005, 11:59 PM
I know, I am worried about the list flickering in size as it is rendered, then the height is reset. The style info is not available until after the page is rendered.
I'll have to just do it and see how bad things are on the different browsers.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum