...
|
...
|
@@ -4,40 +4,45 @@ |
|
|
* @date: 2015/10/12
|
|
|
*/
|
|
|
|
|
|
var $ = require('jquery'),
|
|
|
module.exports = function(specificGender) {
|
|
|
var $ = require('jquery'),
|
|
|
Hammer = require('yoho.hammer'),
|
|
|
tip = require('../plugin/tip'),
|
|
|
loading = require('../plugin/loading'),
|
|
|
lazyLoad = require('yoho.lazyload');
|
|
|
|
|
|
var navHammer,
|
|
|
var navHammer,
|
|
|
winH = $(window).height(),
|
|
|
$goodList = $('#goods-list'),
|
|
|
searching = false,
|
|
|
page = 0,
|
|
|
gender = null,
|
|
|
kidsType = $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
|
|
|
lifestyleType = $('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false,
|
|
|
num,
|
|
|
url;
|
|
|
|
|
|
var $curNav,
|
|
|
//The kidsType can be specified by the parameter. Add by @ZhaoBiao
|
|
|
var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
|
|
|
lifestyleType = specificGender === 'lifestyle' ||
|
|
|
$('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false;
|
|
|
|
|
|
var $curNav,
|
|
|
index,
|
|
|
$navList = $('#maybe-like-nav');
|
|
|
|
|
|
//ajax url
|
|
|
if (kidsType) {
|
|
|
//ajax url
|
|
|
if (kidsType) {
|
|
|
url = '/product/recom/maylikekids';
|
|
|
} else if (lifestyleType) {
|
|
|
} else if (lifestyleType) {
|
|
|
url = '/product/recom/maylikelife';
|
|
|
} else {
|
|
|
gender = $('.mobile-wrap').hasClass('boys-wrap') ? '1,3' : '2,3',
|
|
|
} else {
|
|
|
gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
|
|
|
'1,3' : '2,3',
|
|
|
url = '/product/recom/maylike?gender=' + gender;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$curNav = $navList.children('.focus');
|
|
|
$curNav = $navList.children('.focus');
|
|
|
|
|
|
if (lifestyleType) {
|
|
|
if (lifestyleType) {
|
|
|
navHammer = new Hammer($navList[0]);
|
|
|
navHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target).closest('li'),
|
...
|
...
|
@@ -63,11 +68,11 @@ if (lifestyleType) { |
|
|
$(document).trigger('scroll'); //Trigger lazyLoad
|
|
|
e.srcEvent.stopPropagation();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
loading.init($('.maybe-like'));
|
|
|
loading.init($('.maybe-like'));
|
|
|
|
|
|
function search() {
|
|
|
function search() {
|
|
|
if (searching) {
|
|
|
return;
|
|
|
}
|
...
|
...
|
@@ -131,19 +136,25 @@ function search() { |
|
|
loading.hideLoadingMask();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$('.maybe-like p').on('touchstart', function(e) {
|
|
|
$('.maybe-like p').on('touchstart', function(e) {
|
|
|
search();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
function scrollHandler() {
|
|
|
function scrollHandler() {
|
|
|
if ($(window).scrollTop() + winH >= $(document).height() - 200) {
|
|
|
search();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//srcoll to load more
|
|
|
$(window).scroll(function() {
|
|
|
// 优惠券页面直接加载你可能喜欢。add by @zhaobiao
|
|
|
if (specificGender) {
|
|
|
search();
|
|
|
}
|
|
|
|
|
|
//srcoll to load more
|
|
|
$(window).scroll(function() {
|
|
|
window.requestAnimationFrame(scrollHandler);
|
|
|
}); |
|
|
\ No newline at end of file |
|
|
});
|
|
|
}; |
...
|
...
|
|