<script type="text/javascript">
//1.给窗口添加滚动事件
window.onscroll = function(){
//2. 获取滚动时 滚动条到页面的距离
var sTop = document.documentElement.scrollTop || document.body.scrollTop;
console.log(sTop);
}
</script>
<script type="text/javascript">
//1.给窗口添加滚动事件
window.onscroll = function(){
//2. 获取滚动时 滚动条到页面的距离
var sTop = document.documentElement.scrollTop || document.body.scrollTop;
console.log(sTop);
}
</script>