写在前:获取元素到顶部的距离,获取当前可见高度,获取内容高度,获取滚动高度。
1.获取当前元素距离顶部距离高度。
$(".text_box").offset().top
2.当前窗口可见高度
$(window).height(); //可见高度
3.获取内容高度
$(document).height();
$(".text_box").height();
4.滚动的高度
$(document).scrollTop();
写在前:获取元素到顶部的距离,获取当前可见高度,获取内容高度,获取滚动高度。
1.获取当前元素距离顶部距离高度。
$(".text_box").offset().top
2.当前窗口可见高度
$(window).height(); //可见高度
3.获取内容高度
$(document).height();
$(".text_box").height();
4.滚动的高度
$(document).scrollTop();