الحصول على المطلق 'رأس' الموقف من الحدث الماوس (جافا سكريبت / مسج)

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

  •  20-08-2019
  •  | 
  •  

سؤال

وعلى 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
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top