Ottenere la posizione "superiore" assoluta da un evento del mouse (Javascript / jQuery)

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

  •  20-08-2019
  •  | 
  •  

Domanda

In un evento mouseenter / mouseleave, vorrei catturare la posizione "top" assoluta della cella di una tabella.

Finora, l'evento è allegato in questo modo:

$('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
});
È stato utile?

Soluzione

$(this).offset().top
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top