Bhawna Bhawna - 1 year ago 65
jQuery Question

position().top inconsistencies when (zoom < 1)

I am using a window of fixed position with horizontal and vertical scroll. And using to find the particular position of the div.

var position = anchor.position().top;

But when zoom is 1 or >1 then it is working totally fine.
But when zoom is <1 then there are inconsistencies.

Example Jsfiddle

Answer Source

You have to subtract the position of inner content

var position = anchor.position().top - $('.innercontent').position().top;

Checkout this jsfiddle