1
|
-var $ = require('yoho-jquery');
|
1
|
+var $ = require('yoho-jquery')
|
|
|
2
|
+var Lazyload = require('yoho-jquery-lazyload');
|
2
|
var common = require('../../common');
|
3
|
var common = require('../../common');
|
3
|
|
4
|
|
4
|
var query = common.queryString();
|
5
|
var query = common.queryString();
|
|
@@ -15,6 +16,8 @@ var YohoListPage = { |
|
@@ -15,6 +16,8 @@ var YohoListPage = { |
15
|
require('yoho-jquery-nanoscroller');
|
16
|
require('yoho-jquery-nanoscroller');
|
16
|
require('../../plugins/check');
|
17
|
require('../../plugins/check');
|
17
|
require('../../common/return-top');
|
18
|
require('../../common/return-top');
|
|
|
19
|
+
|
|
|
20
|
+ Lazyload();
|
18
|
$('.nano').nanoScroller();
|
21
|
$('.nano').nanoScroller();
|
19
|
$('.yoho-ui-accordion', this.rootDoc).each(function() {
|
22
|
$('.yoho-ui-accordion', this.rootDoc).each(function() {
|
20
|
var opts = {
|
23
|
var opts = {
|
|
@@ -262,8 +265,8 @@ var YohoListPage = { |
|
@@ -262,8 +265,8 @@ var YohoListPage = { |
262
|
var position = $(e.currentTarget).position();
|
265
|
var position = $(e.currentTarget).position();
|
263
|
var productId = $(e.currentTarget).data('id');
|
266
|
var productId = $(e.currentTarget).data('id');
|
264
|
var imgsSize = $(e.currentTarget).find('.goods-list i').length;
|
267
|
var imgsSize = $(e.currentTarget).find('.goods-list i').length;
|
265
|
- var cols = imgsSize % 4 === 0 ? imgsSize / 4 : (imgsSize / 4 + 1);
|
|
|
266
|
var imgsCol;
|
268
|
var imgsCol;
|
|
|
269
|
+ var pos = {};
|
267
|
|
270
|
|
268
|
if (YohoListPage.goodsWrapperState && YohoListPage.productId !== productId) {
|
271
|
if (YohoListPage.goodsWrapperState && YohoListPage.productId !== productId) {
|
269
|
YohoListPage.goodsWrapperState = false;
|
272
|
YohoListPage.goodsWrapperState = false;
|
|
@@ -271,13 +274,17 @@ var YohoListPage = { |
|
@@ -271,13 +274,17 @@ var YohoListPage = { |
271
|
|
274
|
|
272
|
if (!YohoListPage.goodsWrapperState) {
|
275
|
if (!YohoListPage.goodsWrapperState) {
|
273
|
YohoListPage.productId = productId;
|
276
|
YohoListPage.productId = productId;
|
274
|
- position.top += 10;
|
277
|
+ pos.top = position.top + 10;
|
275
|
|
278
|
|
276
|
if (position.left > 500) {
|
279
|
if (position.left > 500) {
|
277
|
- position.left -= cols * 60;
|
280
|
+ pos.right = 0;
|
|
|
281
|
+ pos.left = 'auto';
|
|
|
282
|
+ } else {
|
|
|
283
|
+ pos.right = 'auto';
|
|
|
284
|
+ pos.left = position.left;
|
278
|
}
|
285
|
}
|
279
|
|
286
|
|
280
|
- $(this.goodsWrapper).css(position);
|
287
|
+ $(this.goodsWrapper).css(pos);
|
281
|
$('.goods', this.goodsWrapper).html($(e.currentTarget).html());
|
288
|
$('.goods', this.goodsWrapper).html($(e.currentTarget).html());
|
282
|
$('.goods-img-list', this.goodsWrapper).empty();
|
289
|
$('.goods-img-list', this.goodsWrapper).empty();
|
283
|
$(e.currentTarget).find('.goods-list i').each(function(index) {
|
290
|
$(e.currentTarget).find('.goods-list i').each(function(index) {
|