获取一个元素距离顶部的位置: $(".box").offset().top; 获取window的滚动值: $(window).scrollTop(); 转载于:https://www.cnblogs.com/gaidalou/p/7238574.html