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(); } }); })
cssfirefly
http://cssfirefly.cnblogs.com
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步