js判断元素距电脑屏幕底部
var st = $(document).scrollTop(); //滚动条高度 var bt = $('#zlzs').offset().top; //元素距页面高度 var wh = window.screen.height; // 电脑屏幕高度 if(bt-st-wh<0){ alert('到达底部了~'); }
添加一个滚动监听事件
$(window).scroll(function(){ var st = $(document).scrollTop(); var bt = $('#zlzs').offset().top; var wh = window.screen.height; if(bt-st-wh<-100){ alert('到达底部了~'); } });