Authored by htoooth

add latest walk lazy load

... ... @@ -26,7 +26,7 @@
{{> product/standard-content}}
{{/if}}
{{> common/latest-walk}}
{{> product/latest-walk}}
</div>
</div>
</div>
... ...
{{#if latestWalk}}
<input id="latest-walk-count" type="hidden" value="{{latestWalk}}">
<div class="latest-walk">
<h2>最近浏览的商品</h2>
<div id="latest-walk-goods" class="goods clearfix"></div>
</div>
{{> product/latest-walk-tpl}}
{{/if}}
\ No newline at end of file
... ... @@ -4,5 +4,10 @@
<h2>最近浏览的商品</h2>
<div id="latest-walk-goods" class="goods clearfix"></div>
</div>
<div class="lazy-load-object">
<textarea class="latest-walk-datalazyload" style="visibility: hidden;">
<script> fetchLatestWalk(); </script>
</textarea>
</div>
{{> product/latest-walk-tpl}}
{{/if}}
\ No newline at end of file
{{/if}}
... ...
... ... @@ -501,7 +501,6 @@ bindEvent.add(function() {
// yas
require('../common');
// 最近浏览
require('./detail/latest-walk');
... ... @@ -583,8 +582,7 @@ window.fetchHotArea = fetchHotArea;
// 商品详情图片懒加载
lazyLoad($('#details-html img'));
// 数据懒加载
dataLazyLoad.init({cls: 'datalazyload', threshold: -50});
// 咨询和评价
function fetchComment() {
... ... @@ -818,3 +816,6 @@ bindEvent.fire();
}
});
}());
// 数据懒加载
dataLazyLoad.init({cls: 'datalazyload', threshold: 0});
... ...
... ... @@ -7,10 +7,11 @@
var $ = require('yoho-jquery');
var Handlebars = require('yoho-handlebars');
var lazyLoad = require('yoho-jquery-lazyload');
var dataLazyLoad = require('../../plugins/lazy-load')(document);
var $latestWalkCount = $('#latest-walk-count');
(function() {
function fetchLatestWalk() {
var tpl;
if ($latestWalkCount.length === 0) {
... ... @@ -59,4 +60,9 @@ var $latestWalkCount = $('#latest-walk-count');
}
}
});
}());
}
window.fetchLatestWalk = fetchLatestWalk;
// 数据懒加载
dataLazyLoad.init({cls: 'latest-walk-datalazyload', threshold: 700});
... ...