jQuery scroll(滚动)延迟加载

延迟加载

$(window).scroll(function(){
var scrollHeight = $(document).height(); //文档高度
var scrollTop = $(this).scrollTop(); //滚动条卷去高度
var windowHeight = $(this).height(); // 窗口高度
// console.log(scrollHeight, scrollTop, windowHeight)
if(scrollHeight - scrollTop - windowHeight < 100 ){ console.log("到底了");
//ajax渲染页面
}
});
jQuery(function($){
var topicBoxTopHeight = jQuery('#topicBox').offset().top;
var topicBoxTopHeight_show = 1
$(window).scroll(function(event){ if($(this).scrollTop() > topicBoxTopHeight-$(window).height()-200 && topicBoxTopHeight_show==1){
topicBoxTopHeight_show=0;
topicBoxFn();
} });
})
上一篇:Android Studio-设置switch/case代码块自动补齐


下一篇:Java Web系统经常使用的第三方接口