Getting position of image inside Gridview using jQuery

If you use offset to get the left & top position of image that is inside a gridview and gridview itself is inside a div, it will give the position from the container that is Div. (In fact it is not absolutely correct because it depends upon the CSS property of container and element on which this method is being applied.)

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