jquery获取div距离顶部的距离
时间:2016-07-22 19:04:44
收藏:0
阅读:4489
获取元素到页面顶部距离的语句为:
1、jquery写法:
$(“#divID”).offset().top //推荐
$("#vertical").position().top
2、js写法:
document.getElementById("divID").offsetTop //推荐
评论(0)