Obtendo posição absoluta 'top' a partir de um evento do mouse (Javascript / jQuery)

StackOverflow https://stackoverflow.com/questions/1045398

  •  20-08-2019
  •  | 
  •  

Pergunta

Em um mouseenter / evento mouseleave, eu gostaria de capturar a posição absoluta 'top' da célula de uma tabela.

Até agora, o evento está ligado assim:

$('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
});
Foi útil?

Solução

$(this).offset().top
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top