Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

85
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda