JS 原生JS 判断滚动条滑动到底部

window.addEventListener("scroll", function(event) {
    var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
    console.log(scrollTop); 
    if(document.documentElement.scrollHeight ==     document.documentElement.clientHeight + scrollTop ) {
    alert("到底部啦");
} 
});

 

posted @ 2017-09-15 14:38  winyh  阅读(1134)  评论(0编辑  收藏  举报