This has probably been asked already, but I was not able to find any fix for what I am trying to do.
I am trying to find the magical combination of properties on the event object, along with scrolling and other offsets, to give me the position of an element relative to the top-most window that may or may not exist within an iframe. I am doing this in an attempt to fade in a small (absolutely positioned) image to the right of the element that is being moused over.
I am trying to get the position inside of a jQuery hover event. I have tried different combinations of the following properties:
$(element).position()
$(element).offset()
$(element).scrollTop()
$(element).scrollLeft();
$(document).scrollTop();
$(document).scrollLeft();
event.clientX
event.clientY
event.pageX
event.pageY
Does anyone have a function or equation that can give these numbers?
I’ve managed to finagle some code that worked for this situation. Hope this helps someone in the future: