King Kong
King Kong

Reputation: 2915

Get the top position of a div

I am trying to get the top of a div element whose position is relative. So the structure is something similar to :

         <div class="head"></div> 
         <div class="main"></div> 
         <div class="foot"></div> 
         div { position : relative; }

Now i tried :

         $(".foot").css("top") => auto

         $(".foot").offset().top => This gives value but that value is 
                           not matching the current top position of the foot div

What i am missing here?

Upvotes: 2

Views: 3478

Answers (2)

jakee
jakee

Reputation: 18556

How about $('.foot').position().top? this gives you the position relative to the parent DOM element

Upvotes: 1

Related Questions