tags:

views:

20

answers:

1

I have a dynamic list of LI's inside of a UL.

I am trying to somehow be able to 'track' the last LI of the UL which has a class of Last.

I thought if I could test for the left property of the actual LI against some number, say -500, then I could do what I need to do.

The issue is I can't seem to get that property.

Is this even possible or does the parent (UL in this case) override that?

A: 

If you want the left position relative to the page, you could do this:

var left = $('ul li.Last').offset().left;

Or relative to its parent, do this:

var left = $('ul li.Last').position().left;

Example: http://jsfiddle.net/7Ztns/

patrick dw
I just tried:alert($('#bottomUL li.Last').offset().left;);and nothing happens?
kelly johnson
@kelly - You would need to remove the semicolon from the inside of the `alert()` (just before the closing parenthesis).
patrick dw
That's it, thanks so much!
kelly johnson