Authored by 周少峰

Merge branch 'feature/mBrandShop' of http://git.dev.yoho.cn/web/yohobuywap into feature/mBrandShop

... ... @@ -62,6 +62,8 @@ var $listNav = $('#list-nav'),
$pre = $listNav.find('.active'), //纪录进入筛选前的active项,初始为选中项
searching;
var viewType = 1; // 1-首页,2-上新,3-人气
//焦点效果
if ($('.banner-swiper').find('li').size() > 1) {
bannerSwiper = new Swiper('.banner-swiper', {
... ... @@ -127,9 +129,62 @@ myScroll = new IScroll('#wrapper', {
click: true
});
function getPageGoods(info) {
if (searching) {
return;
}
searching = true;
$.ajax({
type: 'GET',
url: info.url,
data: info.data,
success: function(data) {
info.callBack(data);
myScroll && myScroll.refresh();
scH = $('#scroller').outerHeight();
searching = false;
},
error: function() {
alert('网络断开连接了~');
searching = false;
}
});
}
function homeData() {
var req = {};
req.url = '/product/newsale/selectNewSale';
req.callBack = function(data) {
$ngc.html(data);
}
getPageGoods(req);
}
function newData() {
console.log('newData');
}
function hotData() {
console.log('hotData');
}
myScroll.on('scroll', function() {
sTop = -this.y;
var sTop = -this.y;
if (sTop + winH * 2 > scH) {
switch(viewType) {
case 1:
homeData();
break;
case 2:
newData();
break;
case 3:
hotData();
break;
}
}
if (sTop < imgH) {
if (!$nav1.hasClass('hide')) {
$nav1.addClass('hide');
... ... @@ -168,9 +223,7 @@ myScroll.on('scroll', function() {
}
if ($nav2.hasClass('hide')) {
$nav2.removeClass('hide');
console.log(1)
}
console.log(sTop + '-----' + scH);
if (sTop < scH) {
if (!$nav2.hasClass('fixed-top')) {
... ... @@ -229,6 +282,7 @@ function search(opt) {
nav, navType,
page;
return;
if (searching) {
return;
}
... ...