| |
| |
| |
| |
| |
| window.onscroll = ()=>{ |
| |
| |
| var windowHeight = document.documentElement.clientHeight || document.body.clientHeight; |
| |
| |
| var documentHeight = document.documentElement.scrollHeight || document.body.scrollHeight; |
| |
| |
| var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; |
| |
| if ((windowHeight + scrollTop + 2) >= documentHeight) { |
| console.log('页面滚动到达底部'); |
| } |
| } |
| |
| |
| document.getElementsByClassName('rank_body')[0].getElementsByTagName('ul')[0].onscroll = (e)=>{ |
| |
| if(e.target.clientHeight + e.target.scrollTop + 2 >= e.target.scrollHeight){ |
| console.log('元素内部页面滚动到达底部'); |
| } |
| } |
| |
| |
| document.getElementsByClassName('rank_body')[0].getElementsByTagName('ul')[0].addEventListener("scroll", (e)=>{ |
| |
| if(e.target.clientHeight + e.target.scrollTop + 2 >= e.target.scrollHeight){ |
| console.log('元素内部页面滚动到达底部'); |
| } |
| }, false); |
| |
| |
| |
| |
| $(window).scroll(function() { |
| |
| |
| var w_h = parseFloat($(window).height()); |
| |
| |
| var doc_h = $(document).height(); |
| |
| |
| totalheight = w_h + parseFloat($(window).scrollTop()) + 2; |
| |
| if (totalheight >= doc_h) { |
| console.log('页面滚动到达底部'); |
| } |
| }); |
| |
| |
| $('#showRankbox').scroll(function() { |
| |
| |
| var box_h = $('#showRankbox').height(); |
| |
| |
| var box_doc_h = parseFloat($('#showRankbox').find(' > ul').height()); |
| var $this = $(this); |
| totalheight = box_h + parseFloat($this.scrollTop()); |
| |
| if (totalheight + 2 >= box_doc_h) { |
| console.log('元素内部页面滚动到达底部'); |
| } |
| }) |