views:

747

answers:

2

On a mouseenter/mouseleave event, I would like to capture the absolute 'top' position of the cell of a table.

So far, the event is attached like so:

$('td[someAttr]').mouseenter(function(mouse) {
   // how do we get the td's top absolute position?

   //FYI: mouse.pageX and mouse.pageY would give the mouse position
});
+2  A: 
$(this).offset().top
redsquare
This will not give that absolute top; it'll give the position relative to its parent element; see http://docs.jquery.com/CSS/position
SLaks
redsquare
Sorry; removed.
SLaks
I mean, un-downed
SLaks
+1  A: 
$(this).offset().top
SLaks
Why was this downvoted?
SLaks
yeah, downvote comments should be mandatory
redsquare