获得绝对值';顶部';鼠标事件的位置(Javascript/jQuery)

获得绝对值';顶部';鼠标事件的位置(Javascript/jQuery),javascript,jquery,mouseevent,Javascript,Jquery,Mouseevent,在mouseenter/mouseleave事件中,我想捕获表格单元格的绝对“顶部”位置 到目前为止,该活动的附件如下: $('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 }); 这将不会给出绝对的顶部;它将给出

在mouseenter/mouseleave事件中,我想捕获表格单元格的绝对“顶部”位置

到目前为止,该活动的附件如下:

$('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
});

这将不会给出绝对的顶部;它将给出相对于其父元素的位置;看,是的,在你的评论和回答之前,我更改为抵消这不会给出绝对的顶部;它将给出相对于其父元素的位置;看,是的,在你的评论和回答之前,我更改为抵消
$(this).offset().top