|
@@ -28,40 +28,46 @@ exports.init = function(num) { |
|
@@ -28,40 +28,46 @@ exports.init = function(num) { |
28
|
$shopEntryArea = $('.shop-entry-area'),
|
28
|
$shopEntryArea = $('.shop-entry-area'),
|
29
|
shopEntryLen = $shopEntry.length;
|
29
|
shopEntryLen = $shopEntry.length;
|
30
|
|
30
|
|
31
|
- if (shopEntryLen > 0) {
|
|
|
32
|
- if (shopEntryLen % 3 === 1) {
|
|
|
33
|
- $shopEntry.eq(shopEntryLen - 1).css({
|
|
|
34
|
- width: '100%'
|
|
|
35
|
- });
|
31
|
+ if (shopEntryLen > 1) {
|
36
|
|
32
|
|
37
|
- $shopEntry.eq(shopEntryLen - 1).find('.name').css({
|
|
|
38
|
- width: '600px'
|
33
|
+ if (shopEntryLen === 3) {
|
|
|
34
|
+ $shopEntry.css({
|
|
|
35
|
+ width: '32%'
|
39
|
});
|
36
|
});
|
40
|
- } else if (shopEntryLen % 3 === 2) {
|
|
|
41
|
- $shopEntry.eq(shopEntryLen - 1).css({
|
|
|
42
|
- width: '49%'
|
37
|
+ } else if (shopEntryLen % 2) {
|
|
|
38
|
+
|
|
|
39
|
+ // 大于 2 ,并且是基数
|
|
|
40
|
+ $('.shop-entry:gt(' + (shopEntryLen - 4) + ')').css({
|
|
|
41
|
+ width: '32%'
|
43
|
});
|
42
|
});
|
|
|
43
|
+ }
|
44
|
|
44
|
|
45
|
- $shopEntry.eq(shopEntryLen - 2).css({
|
|
|
46
|
- width: '49%'
|
45
|
+ $('.shop-entry:nth-child(2n+1)').css({
|
|
|
46
|
+ marginLeft: 0
|
47
|
});
|
47
|
});
|
48
|
|
48
|
|
49
|
- $shopEntry.eq(shopEntryLen - 1).find('.name').css({
|
|
|
50
|
- width: '230px'
|
49
|
+ $shopEntry.last().css({
|
|
|
50
|
+ marginLeft: '2%'
|
51
|
});
|
51
|
});
|
52
|
|
52
|
|
53
|
- $shopEntry.eq(shopEntryLen - 2).find('.name').css({
|
|
|
54
|
- width: '230px'
|
53
|
+ if (shopEntryLen % 2 === 0) {
|
|
|
54
|
+ $shopEntry.find('.name').css({
|
|
|
55
|
+ width: '50%'
|
|
|
56
|
+ });
|
|
|
57
|
+ } else if (shopEntryLen % 3 === 0) {
|
|
|
58
|
+ $shopEntry.find('.name').css({
|
|
|
59
|
+ width: '26%'
|
55
|
});
|
60
|
});
|
56
|
}
|
61
|
}
|
57
|
|
62
|
|
58
|
- $('.shop-entry:nth-child(3n+1)').css({
|
|
|
59
|
- marginLeft: 0
|
63
|
+ } else {
|
|
|
64
|
+ $shopEntry.css({
|
|
|
65
|
+ width: '100%'
|
60
|
});
|
66
|
});
|
61
|
-
|
|
|
62
|
- $shopEntryArea.show();
|
|
|
63
|
}
|
67
|
}
|
64
|
|
68
|
|
|
|
69
|
+ $shopEntryArea.slideDown();
|
|
|
70
|
+
|
65
|
productList = null;
|
71
|
productList = null;
|
66
|
|
72
|
|
67
|
$goodItem.unbind();
|
73
|
$goodItem.unbind();
|