Authored by 梁志锋

update

... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Hammer = require('hammer'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload');
... ...
... ... @@ -22,7 +22,7 @@ var requestFrame,
$logotrans = $('.home-header .logo'),
isen = true;
var navHammer, mobileWrapHammer, sideNavHammer;
var navHammer, mobileWrapHammer;
require('./maybe-like');
... ...
... ... @@ -5,7 +5,6 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
tip = require('../plugin/tip'),
lazyLoad = require('yoho.lazyload');
... ...
... ... @@ -11,7 +11,7 @@ var $searchBox = $('.search-box'),
$indexSearch = $('.index-search'),
$indexLogo = $('.index-logo');
var floatLayerCloseHammer, floatLayerBtnHammer, clearTextHammer, searchIconHammer;
var floatLayerCloseHammer, floatLayerBtnHammer;
function downLoadApp() {
var appUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
... ...
... ... @@ -6,6 +6,7 @@
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('hammer'),
lazyLoad = require('yoho.lazyload');
var swiper;
... ... @@ -14,9 +15,10 @@ var filter = require('../../plugin/filter');
var loading = require('../../plugin/loading');
var $goodsContainer = $('#goods-container'),
$ngc = $($goodsContainer.children().get(0)),
$pgc = $($goodsContainer.children().get(1)),
$dgc = $($goodsContainer.children().get(2));
$goodsChildren = $goodsContainer.children();
$ngc = $($goodsChildren.get(0)),
$pgc = $($goodsChildren.get(1)),
$dgc = $($goodsChildren.get(2));
var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
... ... @@ -56,6 +58,7 @@ var $listNav = $('#list-nav'),
}
},
$pre = $listNav.find('.active'), //纪录进入筛选前的active项,初始为选中项
navHammer,
searching;
if ($('.swiper-container .swiper-slide').length > 1) {
... ... @@ -81,6 +84,9 @@ function search(opt) {
att,
nav, navType,
page;
if (searching) {
return;
}
if (opt) {
... ... @@ -136,9 +142,6 @@ function search(opt) {
$.extend(defaultOpt, ext); //扩展筛选项
}
if (searching) {
return;
}
//导航类别
if ($pre.hasClass('new')) {
... ... @@ -174,7 +177,8 @@ function search(opt) {
url: '/product/newsale/selectNewSale',
data: setting,
success: function(data) {
var $container;
var $container,
num;
switch (navType) {
case 'newest':
... ... @@ -197,11 +201,15 @@ function search(opt) {
} else {
if (nav.reload) {
$container.html(data);
lazyLoad($container.find('.lazy'));
} else {
num = $container.find('.good-info').length;
$container.append(data);
//lazy good-infos who append in
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
}
lazyLoad($container.find('.lazy'));
}
nav.reload = false;
... ... @@ -214,19 +222,38 @@ function search(opt) {
}
$.ajax({
type: 'GET',
url: '/newArrival/filter',
data: defaultOpt,
success: function(data) {
$goodsContainer.append(data);
//初始化filter&注册filter回调
filter.initFilter({
fCbFn: search,
hCbFn: function() {
//切换active状态到$pre上
$pre.addClass('active');
$pre.siblings('.filter').removeClass('active');
},
missStatus: true
});
}
});
lazyLoad($('.lazy'));
filter.registerCbFn(search);
// loading.initLoadingMask();
//导航栏点击逻辑说明:
//1.点击非active项时切换active状态
//2.价格和折扣active状态时继续点击切换排序
//3.筛选无active时点击展开筛选面板
//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
//5.当前active为筛选并且点击其他项时,隐藏筛选面板
$listNav.delegate('li', 'touchstart', function() {
var $this = $(this),
navHammer = new Hammer($listNav[0]);
navHammer.on('tap', function(e) {
var $this = $(e.target).closest('li'),
nav,
navType,
$active;
... ...
... ... @@ -6,17 +6,19 @@
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('hammer'),
lazyLoad = require('yoho.lazyload');
var swiper;
var swiper,
$ngc,
$pgc,
$dgc;
var filter = require('../../plugin/filter');
var loading = require('../../plugin/loading');
var $goodsContainer = $('#goods-container'),
$ngc = $($goodsContainer.children().get(0)),
$pgc = $($goodsContainer.children().get(1)),
$dgc = $($goodsContainer.children().get(2));
$goodsChildren = $goodsContainer.children();
var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
... ... @@ -60,11 +62,12 @@ var $listNav = $('#list-nav'),
}
},
$pre = $listNav.find('.active'), //纪录进入筛选前的active项,初始为选中项
navHammer,
searching;
$pgc.addClass('hide');
$dgc.addClass('hide');
$ngc = $($goodsChildren.get(0)),
$pgc = $($goodsChildren.get(1)).addClass('hide'),
$dgc = $($goodsChildren.get(2)).addClass('hide');
$('#today a').text(month + '月' + date + '号');
if ($('.swiper-container .swiper-slide').length > 1) {
... ... @@ -92,6 +95,10 @@ function search(opt) {
dayLimit,
page;
if (searching) {
return;
}
if (opt) {
//筛选项变更则重置reload为true
... ... @@ -161,10 +168,6 @@ function search(opt) {
$.extend(defaultOpt, ext); //扩展筛选项
}
if (searching) {
return;
}
//导航类别
if ($pre.hasClass('today')) {
navType = 'today';
... ... @@ -201,7 +204,8 @@ function search(opt) {
url: '/product/newsale/selectNewSale',
data: setting,
success: function(data) {
var $container;
var $container,
num;
switch (navType) {
case 'today':
... ... @@ -224,11 +228,15 @@ function search(opt) {
} else {
if (nav.reload) {
$container.html(data);
lazyLoad($container.find('.lazy'));
} else {
num = $container.find('.good-info').length;
$container.append(data);
//lazy good-infos who append in
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
}
lazyLoad($container.find('.lazy'));
}
nav.reload = false;
... ... @@ -241,19 +249,37 @@ function search(opt) {
}
$.ajax({
type: 'GET',
url: '/product/newsale/filter',
data: defaultOpt,
success: function(data) {
$goodsContainer.append(data);
//初始化filter&注册filter回调
filter.initFilter({
fCbFn: search,
hCbFn: function() {
//切换active状态到$pre上
$pre.addClass('active');
$pre.siblings('.filter').removeClass('active');
},
missStatus: true
});
}
});
lazyLoad($('.lazy'));
filter.registerCbFn(search);
//导航栏点击逻辑说明:
//1.点击非active项时切换active状态
//2.价格和折扣active状态时继续点击切换排序
//3.筛选无active时点击展开筛选面板
//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
//5.当前active为筛选并且点击其他项时,隐藏筛选面板
$listNav.delegate('li', 'touchstart', function() {
var $this = $(this),
navHammer = new Hammer($listNav[0]);
navHammer.on('tap', function(e) {
var $this = $(e.target).closest('li'),
nav,
navType,
$active;
... ...