jquery获取div距离顶部的距离
获取元素到页面顶部距离的语句为:
1、jquery写法:
$(“#divID”).offset().top //推荐
$("#vertical").position().top
2、js写法:
document.getElementById("divID").offsetTop //推荐
文章来自:http://www.cnblogs.com/webapi/p/5696008.html
获取元素到页面顶部距离的语句为:
1、jquery写法:
$(“#divID”).offset().top //推荐
$("#vertical").position().top
2、js写法:
document.getElementById("divID").offsetTop //推荐