标签:加载 === type UNC isl body ons doc 加载失败
canILoad:function(elem,method){ var scrollDistance = document.body.scrollTop||document.documentElement.scrollTop; //获取滚动距离 var availableViewHeight = document.body.clientHeight; //可视区域高度 var advancedDistance = 30; //提前多少开始加载 if(scrollDistance + availableViewHeight > elem.offsetTop - advancedDistance){ if(!elem.isLoad){ console.log("加载成功"); if(typeof(method)==="function"){ method(); elem.isLoad = true; }else{ console.log("加载失败"); } } } }
标签:加载 === type UNC isl body ons doc 加载失败
原文地址:https://www.cnblogs.com/JianXin1994/p/11588626.html