...
|
...
|
@@ -12,32 +12,32 @@ exports.init = function() { |
|
|
$(function() {
|
|
|
var container = $('.article-type-three'),
|
|
|
thumbContainer = container.find('.thumb-container'),
|
|
|
prodList = container.find('.prod-list'),
|
|
|
curItem, //当前focus搭配项
|
|
|
prevItem, //上一次focus的搭配项
|
|
|
curList, //当前focus搭配项对应推荐列表
|
|
|
prevList; //上一次focus的搭配项对应的列表
|
|
|
prodList = container.find('.prod-list');
|
|
|
|
|
|
//点击分类,显示分类下推荐商品列表
|
|
|
thumbContainer.delegate('li', 'click', function() {
|
|
|
var index;
|
|
|
curItem = $(this).addClass('focus');
|
|
|
thumbContainer.delegate('.thumb', 'click', function() {
|
|
|
var thisContainer,
|
|
|
curItem,
|
|
|
index;
|
|
|
curItem = $(this);
|
|
|
|
|
|
thisContainer = curItem.closest('.article-type-three');
|
|
|
|
|
|
index = curItem.index();
|
|
|
if (prevItem) {
|
|
|
prevItem.removeClass('focus');
|
|
|
}
|
|
|
prevItem = curItem;
|
|
|
thisContainer.find('.thumb-container .thumb').removeClass('focus')
|
|
|
curItem.addClass('focus');
|
|
|
|
|
|
curList = prodList.find('.prod:eq(' + index + ')').removeClass('hide');
|
|
|
if (prevList) {
|
|
|
prevList.addClass('hide');
|
|
|
}
|
|
|
prevList = curList;
|
|
|
thisContainer.find('.prod-list .prod')
|
|
|
.addClass('hide')
|
|
|
.eq(index)
|
|
|
.removeClass('hide');
|
|
|
});
|
|
|
|
|
|
//默认选中第一个
|
|
|
thumbContainer.find('li:first-child').click();
|
|
|
|
|
|
thumbContainer.each(function() {
|
|
|
$(this).find('.thumb:first-child').click();
|
|
|
});
|
|
|
|
|
|
//scroll时控制列表的位置
|
|
|
$(document).scroll(function() {
|
|
|
var sTop = $(this).scrollTop(),
|
...
|
...
|
|