| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
I Ain't Losing Any Sleep™
Join Date: Apr 2003
Posts: 5,238
|
JQuery question...
Afternoon all, With JQuery is it possible to find the length of something (a list item in this case) and then add a CSS rule (some padding) to another item using that length value? Much appreciated. That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
|
|
|
|
|
|
#4 (permalink) |
|
trouble free and loverlee
Join Date: Mar 2003
Location: YooKay
Posts: 2,926
|
As the list items are block-level, they expand to fill the available space by default. So, to get the px width of the content, rather than the list item itself, you'll either need to make them inline, float and clear them or wrap the textual content in an inline element - e.g. span. This'll mean the list item will wrap neatly around the content. … Code:
If you're wrapping the content in a span, then obviously you'll need to target the span element in the el var instead… Code:
|
|
![]() |