View Single Post
Old 12-27-2012, 11:35 PM   PM User | #1
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
Giving absolute positioned items an auto width

I made a simple drop down menu, eg mouse over an item and a list of items drops down from it.

I wrote some Javascript (jQuery) that gives the item that drops down (a ul) a min-width equal to the link it comes from. The problem I'm having is that the dropdown's content is auto generated, can be multiword, and is often longer then the width of the parent. Because its absolutely positioned, it doesn't get wider though; it sticks to the min width. So I have some items that are going multi-line and it looks weird.

I'm wondering if anyone knows how to get an absolutely positioned item to get an auto width (if this makes sense), or knows a Javascript trick I could use to do it?
Keleth is offline   Reply With Quote