前端页面加载一页问题,比如京东淘宝首页都是一个框架,数据是等滚到位置时间再加载


比如京东,就一个框架,这样的加载是不是只要 scroll 事件就可以啦,单页面滚到某位置就记载,还需要考虑其他因数吗?


 <div class="lazy-fn-wrap clearfix" data-space="2">
    <div class="floor-banner-body lazy-fn" id="lazy-floor-banner-1"  data-path="floor1-floor_banner.js" data-time="3bbc1b7349db4d94b09080ef56c61e56"></div>
    <div class="w floor lazy-fn" data-title="服饰" id="lazy-clothes" data-path="floor1-floor_index.js" data-time="bcc9afdc68587b1f3d6bb071393bfef1"></div>
    <div class="w floor lazy-fn" data-title="美妆" id="lazy-cosmetics" data-path="floor2-floor_index.js" data-time="0af89b16e74e1ef36850cdf88fa0ccf3"></div>
    <div class="floor-banner-body lazy-fn" id="lazy-floor-banner-2"  data-path="floor3-floor_banner.js" data-time="cd1d6c9250f4e600c90832c9ead5c0fd"></div>
    <div class="w floor lazy-fn" data-title="手机" id="lazy-mobiles" data-path="floor5-floor_index.js" data-time="da115c0a346098b818400f62e7efc3bb"></div>
    <div class="w floor lazy-fn" data-title="家电" id="lazy-electronics" data-path="floor3-floor_index.js" data-time="33cbdf142b4cdd57c6f1dad654398174"> </div>
    <div class="w floor lazy-fn" data-title="数码" id="lazy-digitals" data-path="floor4-floor_index.js" data-time="1160fbaf537289b94653afbc539251a3"></div>
    <div class="floor-banner-body lazy-fn" id="lazy-floor-banner-3"  data-path="floor6-floor_banner.js" data-time="b3c4f7a884a482d40f9009bb12c4d571"> </div>
    <div class="w floor lazy-fn" data-title="运动" id="lazy-sports" data-path="floor6-floor_index.js" data-time="c713bc4726b211c69b0f7565a99be5ab"></div>
    <div class="w floor lazy-fn" data-title="居家" id="lazy-livings" data-path="floor7-floor_index.js" data-time="e536baa1168d1453492f346a6641a1fa"></div>
    <div class="w floor lazy-fn" data-title="母婴" id="lazy-babys" data-path="floor8-floor_index.js" data-time="30836263d05a010072bc804177c260d1"></div>
    <div class="w floor lazy-fn" data-title="食品" id="lazy-foods" data-path="floor9-floor_index.js" data-time="7f6217c68a46d0caf20c1bbd435ddce4"></div>
    <div class="floor-banner-body lazy-fn" id="lazy-floor-banner-4" data-path="floor10-floor_banner.js" data-time="7c3c9df13c6ecf9991f4a722ad4fefdc" ></div>
    <div class="w floor lazy-fn" data-title="图书" id="lazy-books" data-path="floor10-floor_index.js" data-time="25aa137a4b5d883d357a791d1fd531a4"></div>
    <div class="w floor lazy-fn" data-title="服务" id="lazy-life" data-path="floor11-floor_index.js" data-time="34a9321e9ff3248b07eb61d76cbcea39"></div>
    <div class="w clearfix lazy-fn" id="lazy-special" data-path="special-special.js" data-time="de6d1f8779a12a9a5a6dc69c548039c9"></div>
    <div class="lazy-fn" id="lazy-footer" data-path-js="product/home/1.0.0/widget/home-footer/home-footer.js"></div>
</div>

前端开发 scroll

没人看的喜剧 9 years, 5 months ago

懒加载,之前看到还要考虑noscript的情况吧,ios7,8上对scroll事件计算位置好想也有差别,

伊丽莎白大叔 answered 9 years, 5 months ago

Your Answer