Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get x y position of an element

function getOffset(el) {
  const rect = el.getBoundingClientRect();
  return {
    left: rect.left + window.scrollX,
    top: rect.top + window.scrollY
  };
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #position #element
ADD COMMENT
Topic
Name
2+3 =