To get the absolute X, Y coordinates of an element on the page, you can use the offset() method: (body attribute setting margin: 0; padding: 0;)
var X = $('#DivID').offset().top; var Y = $('#DivID').offset().left; 获取相对(父元素)位置: var X = $('#DivID').position().top; var Y = $('#DivID').position().left;