There is another method available in jQuery that gives you the left & top position from window/screen instead of parent/container.
You can apply both according to requirement.
Use jQuery Offset to get the top & left value relative to window instead of div.
var topValue = $("yourElementSelectorID").offset().top;
var leftValue = $("yourElementSelectorID").offset().left;
OR you can use position() to get the position relative to the offset parent.
var topValue = $("yourElementSelectorID").position().top;
var leftValue = $("yourElementSelectorID").position().left;
Thanks,
@AnilAwadh

Join the conversation! Your thoughts help the community grow.