JS 中 getBoundingClientRect 方法
getBoundingClientRect用于获取某个html元素相对于视窗的位置集合
var box=document.getElementById('box');//获取元素
alert(box.getBoundingclientRect().top);//元素上边距离页面上边的距离
alert(box.getBoundingclientRect().right);// 元素右边距离页面左边的距离
alert(box.getBoundingclientRect().bottom);//元素下边距离页面上边的距离
alert(box.getBoundingclientRect().left);//元素左边距离页面左边的距离