|
@@ -83,88 +83,12 @@ exports.init = function(num) { |
|
@@ -83,88 +83,12 @@ exports.init = function(num) { |
83
|
});
|
83
|
});
|
84
|
}
|
84
|
}
|
85
|
|
85
|
|
86
|
- // 原来的
|
|
|
87
|
- // productList.addHandler('MouseEnter', function(event) {
|
|
|
88
|
- // var itemMr = 10, // list的右边距
|
|
|
89
|
- // itemMb = 35, // list的下边距
|
|
|
90
|
- // ulStr = '',
|
|
|
91
|
- // ulNum,
|
|
|
92
|
- // wrapperWidth,
|
|
|
93
|
- // diffWidth,
|
|
|
94
|
- // wrapperX,
|
|
|
95
|
- // wrapperY,
|
|
|
96
|
- // wrapperPl, // 鼠标移入时弹层的左内边距
|
|
|
97
|
- // wrapperPt, // 鼠标移入时弹层的上内边距
|
|
|
98
|
- // containerPt, // 商品列表容器的上内边距
|
|
|
99
|
- // _from = event.target.attr('data-from') || '';
|
|
|
100
|
- //
|
|
|
101
|
- // $.ajax({
|
|
|
102
|
- // type: 'POST',
|
|
|
103
|
- // url: '/product/list/getProductPic',
|
|
|
104
|
- // dataType: 'jsonp',
|
|
|
105
|
- // jsonp: 'callback',
|
|
|
106
|
- // data: {
|
|
|
107
|
- // skn: event.target.attr('data-skn'),
|
|
|
108
|
- // skc: event.target.attr('data-skc')
|
|
|
109
|
- // }
|
|
|
110
|
- // }).then(function(res) {
|
|
|
111
|
- // var data = res.data,
|
|
|
112
|
- // colorList = createColorList(data.pics, _from);
|
|
|
113
|
- //
|
|
|
114
|
- // removeHtmlFn();
|
|
|
115
|
- //
|
|
|
116
|
- // ulStr = colorList.colorListStr; // ajax请求的颜色列表
|
|
|
117
|
- // ulNum = colorList.ulNum;// ajax请求的颜色的数量
|
|
|
118
|
- //
|
|
|
119
|
- // $goodInfoMain.append(event.targetDuplicate);
|
|
|
120
|
- // $goodSelectColor.append($(ulStr));
|
|
|
121
|
- //
|
|
|
122
|
- // // 点击收藏商品不需要了
|
|
|
123
|
- // // if (data.isFavorite) {
|
|
|
124
|
- // // $goodInfoMain.find('.col-btn').addClass('coled');
|
|
|
125
|
- // // } else {
|
|
|
126
|
- // // $goodInfoMain.find('.col-btn').removeClass('coled');
|
|
|
127
|
- // // }
|
|
|
128
|
- //
|
|
|
129
|
- // wrapperPl = $goodItemWrapper.css('paddingLeft');
|
|
|
130
|
- // wrapperPt = $goodItemWrapper.css('paddingTop');
|
|
|
131
|
- // containerPt = $goodsContainer.css('paddingTop');
|
|
|
132
|
- //
|
|
|
133
|
- // wrapperWidth = 10 + (15 + 50) * ulNum + event.targetWidth;
|
|
|
134
|
- //
|
|
|
135
|
- // // wrapperWidth = $goodItemWrapper.width();
|
|
|
136
|
- //
|
|
|
137
|
- // wrapperX = (event.targetX - 1) * (event.targetWidth + itemMr) - (parseInt(wrapperPl) + 1);
|
|
|
138
|
- // wrapperY = (event.targetY - 1) *
|
|
|
139
|
- // (event.targetHeight + itemMb) + parseInt(containerPt) - (parseInt(wrapperPt) + 1);
|
|
|
140
|
- //
|
|
|
141
|
- // // todo
|
|
|
142
|
- // // event.offsetR表示当前列表距离浏览器右侧边缘的距离
|
|
|
143
|
- // diffWidth = event.offsetR - ((15 + 50) * ulNum + 25);
|
|
|
144
|
- //
|
|
|
145
|
- // if (diffWidth <= 0) {
|
|
|
146
|
- // wrapperX = wrapperX + diffWidth - 25;
|
|
|
147
|
- // }
|
|
|
148
|
- // $goodItemWrapper.css({
|
|
|
149
|
- // width: wrapperWidth,
|
|
|
150
|
- // left: wrapperX,
|
|
|
151
|
- // top: wrapperY,
|
|
|
152
|
- // display: 'inline-block'
|
|
|
153
|
- // });
|
|
|
154
|
- //
|
|
|
155
|
- // // 鼠标悬浮获取到商品信息后显示第一张图片
|
|
|
156
|
- // if (data.pics[0] && data.pics[0].src) {
|
|
|
157
|
- // $goodInfoMain.find('.good-thumb img').attr('src', data.pics[0].src);
|
|
|
158
|
- // }
|
|
|
159
|
- // });
|
|
|
160
|
- // });
|
|
|
161
|
-
|
|
|
162
|
productList.addHandler('MouseEnter', function(event) {
|
86
|
productList.addHandler('MouseEnter', function(event) {
|
163
|
var itemMr = 10, // list的右边距
|
87
|
var itemMr = 10, // list的右边距
|
164
|
itemMb = 35, // list的下边距
|
88
|
itemMb = 35, // list的下边距
|
165
|
- imageList,
|
|
|
166
|
colorList,
|
89
|
colorList,
|
167
|
- pic, pics,
|
90
|
+ pic,
|
|
|
91
|
+ pics,
|
168
|
ulNum, ulStr,
|
92
|
ulNum, ulStr,
|
169
|
wrapperWidth,
|
93
|
wrapperWidth,
|
170
|
diffWidth,
|
94
|
diffWidth,
|
|
@@ -177,21 +101,13 @@ exports.init = function(num) { |
|
@@ -177,21 +101,13 @@ exports.init = function(num) { |
177
|
|
101
|
|
178
|
|
102
|
|
179
|
pics = [];
|
103
|
pics = [];
|
180
|
- event.target.find('.goodsList').find('.list').each(function() {
|
|
|
181
|
- pic = {
|
|
|
182
|
- url: $(this).attr('url'),
|
|
|
183
|
- src: $(this).attr('imgUrl'),
|
|
|
184
|
- coverImg: $(this).attr('cover')
|
|
|
185
|
- };
|
104
|
+ event.target.find('.hideList > li').each(function() {
|
|
|
105
|
+ pic = $(this).data();
|
|
|
106
|
+ pic.coverImg = pic.src;
|
186
|
pics.push(pic);
|
107
|
pics.push(pic);
|
187
|
});
|
108
|
});
|
188
|
|
109
|
|
189
|
-
|
|
|
190
|
- imageList = {
|
|
|
191
|
- pics: pics
|
|
|
192
|
- };
|
|
|
193
|
-
|
|
|
194
|
- colorList = createColorList(imageList.pics, _from);
|
110
|
+ colorList = createColorList(pics, _from);
|
195
|
|
111
|
|
196
|
removeHtmlFn();
|
112
|
removeHtmlFn();
|
197
|
|
113
|
|
|
@@ -227,8 +143,8 @@ exports.init = function(num) { |
|
@@ -227,8 +143,8 @@ exports.init = function(num) { |
227
|
});
|
143
|
});
|
228
|
|
144
|
|
229
|
// 鼠标悬浮获取到商品信息后显示第一张图片
|
145
|
// 鼠标悬浮获取到商品信息后显示第一张图片
|
230
|
- if (imageList.pics[0] && imageList.pics[0].src) {
|
|
|
231
|
- $goodInfoMain.find('.good-thumb img').attr('src', imageList.pics[0].src);
|
146
|
+ if (pics[0] && pics[0].src) {
|
|
|
147
|
+ $goodInfoMain.find('.good-thumb img').attr('src', pics[0].src);
|
232
|
}
|
148
|
}
|
233
|
});
|
149
|
});
|
234
|
|
150
|
|
|
@@ -242,11 +158,11 @@ exports.init = function(num) { |
|
@@ -242,11 +158,11 @@ exports.init = function(num) { |
242
|
});
|
158
|
});
|
243
|
|
159
|
|
244
|
};
|
160
|
};
|
245
|
-
|
161
|
+console.log(1111);
|
246
|
// 鼠标放在颜色列表上效果
|
162
|
// 鼠标放在颜色列表上效果
|
247
|
-$(document).on('hover', '.good-select-color li', function() {
|
163
|
+$(document).on('mouseenter', '.good-select-color li', function() {
|
248
|
var coverImg = $(this).find('img').attr('data-cover'),
|
164
|
var coverImg = $(this).find('img').attr('data-cover'),
|
249
|
- $coverImg = $(this).closest('.good-item-wrapper').find('.good-detail-img').find('img');
|
165
|
+ $coverImg = $(this).closest('.good-item-wrapper').find('.good-detail-img img');
|
250
|
|
166
|
|
251
|
$coverImg.attr('src', coverImg);
|
167
|
$coverImg.attr('src', coverImg);
|
252
|
});
|
168
|
});
|