获得绝对的“顶”位置从鼠标事件(使用Javascript / jQuery的)
-
20-08-2019 - |
题
在一个的mouseenter /鼠标离开事件,我想捕捉的表格的单元格的绝对“顶部”位置。
到目前为止,该事件被附像这样:
$('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
不隶属于 StackOverflow