Getting absolute 'top' position from a mouse event (Javascript/jQuery)
-
20-08-2019 - |
Question
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
});
Solution
$(this).offset().top
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow