Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am using a window of fixed position with horizontal and vertical scroll. And using position.top() 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

like image 401
Bhawna Avatar asked Oct 19 '22 01:10

Bhawna


1 Answers

You have to subtract the position of inner content

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

Checkout this jsfiddle

like image 138
Vivek Kumar Avatar answered Oct 20 '22 17:10

Vivek Kumar