...
|
...
|
@@ -24,13 +24,6 @@ var $brandDefault = $('.brand .default'), |
|
|
|
|
|
var $brandMoreTxt, $brandMoreIcon;
|
|
|
|
|
|
//商品相关变量
|
|
|
var $goodsContainer = $('.goods-container'),
|
|
|
$goodItem = $goodsContainer.find('.good-info'),
|
|
|
$goodItemWrapper = $goodsContainer.find('.good-item-wrapper'),
|
|
|
$goodInfoMain = $goodsContainer.find('.good-info-main'),
|
|
|
$goodSelectColor = $goodsContainer.find('.good-select-color');
|
|
|
|
|
|
//价格相关变量
|
|
|
var $udPrice = $('.ud-price-range'),
|
|
|
interReg = /^\d+$/,
|
...
|
...
|
@@ -328,100 +321,3 @@ $('.senior-sub').on('click', '.multi-select', function() { |
|
|
}
|
|
|
});
|
|
|
}()); |
|
|
|
|
|
|
|
|
/*
|
|
|
* Description: 商品列表移入效果
|
|
|
* Added by wangchenglong at 2015/12/1
|
|
|
*/
|
|
|
|
|
|
// 构造html
|
|
|
function createColorList(data) {
|
|
|
var colorListStr = '',
|
|
|
len = data.length,
|
|
|
row = 4, //每列ul放4个li
|
|
|
col = Math.ceil(len / row), //需要几**列**ul
|
|
|
i,
|
|
|
j,
|
|
|
index,
|
|
|
ulNum = 0;
|
|
|
|
|
|
for (i = 0; i < col; i++) {
|
|
|
colorListStr += '<ul>';
|
|
|
for (j = 0; j < row; j++) {
|
|
|
index = i * row + j;
|
|
|
if (index === len) {
|
|
|
break;
|
|
|
}
|
|
|
colorListStr +=
|
|
|
'<li>' +
|
|
|
'<a href="' + data[i * row + j].url + '">' +
|
|
|
'<img src="' + data[i * row + j].src + '" />' +
|
|
|
'</a>' +
|
|
|
'</li>';
|
|
|
|
|
|
if (j === row - 1) {
|
|
|
colorListStr += '</ul>';
|
|
|
ulNum++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (ulNum < col) {
|
|
|
colorListStr += '</ul>';
|
|
|
}
|
|
|
return colorListStr;
|
|
|
}
|
|
|
|
|
|
//todo
|
|
|
$goodItem.mouseenter(function() {
|
|
|
var $cloneStr,
|
|
|
activeIndex,
|
|
|
X,
|
|
|
left,
|
|
|
Y,
|
|
|
top,
|
|
|
colNum = 5,
|
|
|
itemW = 222,
|
|
|
itemH = 400,
|
|
|
itemMr = 10,
|
|
|
itemMb = 35;
|
|
|
|
|
|
activeIndex = $(this).index() + 1;
|
|
|
|
|
|
X = (activeIndex % colNum) === 0 ? colNum : activeIndex % colNum;
|
|
|
Y = Math.ceil(activeIndex / colNum);
|
|
|
left = (X - 1) * (itemW + itemMr) + 15 - 21;
|
|
|
top = (Y - 1) * (itemH + itemMb) + 25 - 19;
|
|
|
|
|
|
$cloneStr = $(this).clone();
|
|
|
|
|
|
$goodInfoMain.html('');
|
|
|
$goodSelectColor.html('');
|
|
|
$goodItemWrapper.css({
|
|
|
display: 'none'
|
|
|
});
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/index/productColor',
|
|
|
dataType: 'json'
|
|
|
}).then(function(data) {
|
|
|
|
|
|
$goodInfoMain.append($cloneStr);
|
|
|
$goodSelectColor.append($(createColorList(data)));
|
|
|
});
|
|
|
|
|
|
$goodItemWrapper.css({
|
|
|
left: left,
|
|
|
top: top,
|
|
|
display: 'inline-block'
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
$goodItemWrapper.mouseleave(function() {
|
|
|
$goodInfoMain.html('');
|
|
|
$goodSelectColor.html('');
|
|
|
$goodItemWrapper.css({
|
|
|
display: 'none'
|
|
|
});
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|