Authored by 姜枫

添加图片懒加载

... ... @@ -194,6 +194,7 @@ const helpers = {
letters: this.brandLetters(),
customPriceLow: customPriceLow,
customPriceHigh: customPriceHigh,
showSize: !!q.sort,
nav: this.getSortNav(q.sort, sorts)
};
}
... ...
... ... @@ -95,6 +95,7 @@
</div>
</div>
{{#if showSize}}
<div class="yoho-ui-accordion">
<h3>尺码</h3>
<div class="body">
... ... @@ -110,6 +111,7 @@
</div>
</div>
</div>
{{/if}}
<div class="yoho-ui-accordion">
<h3>颜色</h3>
... ...
... ... @@ -2,7 +2,7 @@
{{#each products}}
<div class="goods" data-id="{{productId}}">
<div class="goods-img">
<img src="{{image defaultImages 265 344}}" width="265" height="344" alt="">
<img class="lazy" data-original="{{image defaultImages 265 344}}" width="265" height="344" alt="">
</div>
<div class="goods-brand">
{{brandName}}
... ... @@ -29,4 +29,4 @@
<div class="goods-img-list">
</div>
</div>
</div>
\ No newline at end of file
</div>
... ...
var $ = require('yoho-jquery');
var $ = require('yoho-jquery')
var Lazyload = require('yoho-jquery-lazyload');
var common = require('../../common');
var query = common.queryString();
... ... @@ -15,6 +16,8 @@ var YohoListPage = {
require('yoho-jquery-nanoscroller');
require('../../plugins/check');
require('../../common/return-top');
Lazyload();
$('.nano').nanoScroller();
$('.yoho-ui-accordion', this.rootDoc).each(function() {
var opts = {
... ... @@ -262,8 +265,8 @@ var YohoListPage = {
var position = $(e.currentTarget).position();
var productId = $(e.currentTarget).data('id');
var imgsSize = $(e.currentTarget).find('.goods-list i').length;
var cols = imgsSize % 4 === 0 ? imgsSize / 4 : (imgsSize / 4 + 1);
var imgsCol;
var pos = {};
if (YohoListPage.goodsWrapperState && YohoListPage.productId !== productId) {
YohoListPage.goodsWrapperState = false;
... ... @@ -271,13 +274,17 @@ var YohoListPage = {
if (!YohoListPage.goodsWrapperState) {
YohoListPage.productId = productId;
position.top += 10;
pos.top = position.top + 10;
if (position.left > 500) {
position.left -= cols * 60;
pos.right = 0;
pos.left = 'auto';
} else {
pos.right = 'auto';
pos.left = position.left;
}
$(this.goodsWrapper).css(position);
$(this.goodsWrapper).css(pos);
$('.goods', this.goodsWrapper).html($(e.currentTarget).html());
$('.goods-img-list', this.goodsWrapper).empty();
$(e.currentTarget).find('.goods-list i').each(function(index) {
... ...