jquery get element position code example
Example 1: jquery get relative position of element
let rel = $('.someClass').position();
let abs = $('.someClass').offset();
Example 2: how to get element position in jquery
.offset() will return the offset position of an element as a simple object, eg:
var position = $(element).offset();
You can use this return value to position other elements at the same spot:
$(anotherElement).css(position)
Example 3: jquery get left position
var position = p.position();
var left = position.left; '<-- left value for p