Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

81
Views
Getting incorrect offsetTop position even though i'm using correct syntax

I'm trying to get the offsetTop position shown in google chromes inspector when you output an element.

The exact measurement it shows for offsetTop is "2942" but when I try the following below, it shows many different numbers but none is equal to that number.

It's instead showing "924" which i'm not sure what it's relative to.

The DOM tree looks like this:

Parent DIV (absolute positioned)

Child DIV (positioned relative)

Element (positioned relative) (Showing 924 for offsetLeft instead of 2942 in inspector.

How can I get it to match the value of 2942 for offset instead of 924?

Code:

$('.draggable:not(.container, #pageBody, .boundingBox)').each(function(){
                allElmDistY.push($(this).offset().top);
                allElmDistY.push($(this).position().top);
                allElmDistY.push($(this)[0].offsetTop);

                console.log($(this)[0].offsetTop, $(this));
            })

I'm outputting the information inside the loop so I can look at it through the developer console as well as which element it's being refered to.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!