views:

28

answers:

1

Hey, I have the following function:

function getPosition() {
    var cLeft = $('#element').position().left;
    var cTop = $('#element').position().top;
}

I also have this:

$('ul#container>li.node:eq('+XXX+')').css({'border' : '5px solid yellow'});

Now, is it possible to determine what index for the LI's is at the co-ordinates provided by getPosition() ?

Note: XXX denotes where I would like the index of the LI's to be.

+1  A: 

Here is some plain JavaScript

var elementAtCoords = document.elementFromPoint(x, y);

I'm not sure support for IE, but Firefox has had it since 3.

To start going crazy with jQuery, simply wrap it

$(elementAtCoords).slideDown(2000);
alex
***mock cockney accent*** Nice one my son!
Neurofluxation