I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript relative to the browser window.
img
div
This is easy as two lines in JS :
var elem = document.getElementById("id"); alert(elem.getBoundingClientRect());