Authored by xuqi

修正点击区块没反应的bug

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