Authored by hf

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

framework @ 119c247f
1 -Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2 1 +Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
@@ -19,7 +19,11 @@ var winH = $(window).height(), @@ -19,7 +19,11 @@ var winH = $(window).height(),
19 num, 19 num,
20 url; 20 url;
21 21
22 -///recom/maylikekids 22 +var $curNav,
  23 + index,
  24 + $navList = $('#maybe-like-nav');
  25 +
  26 +//ajax url
23 if (kidsType) { 27 if (kidsType) {
24 url = '/product/recom/maylikekids'; 28 url = '/product/recom/maylikekids';
25 } else if (lifestyleType) { 29 } else if (lifestyleType) {
@@ -28,15 +32,38 @@ if (kidsType) { @@ -28,15 +32,38 @@ if (kidsType) {
28 url = '/product/recom/maylike?gender=' + gender; 32 url = '/product/recom/maylike?gender=' + gender;
29 } 33 }
30 34
  35 +$curNav = $navList.children('.focus');
  36 +
  37 +$('#maybe-like-nav').delegate('li', 'touchstart', function() {
  38 + var $this = $(this),
  39 + $goods = $('.goods-list'),
  40 + $content;
  41 +
  42 +
  43 + if ($this.hasClass('focus')) {
  44 + return;
  45 + }
  46 +
  47 + index = $this.index();
  48 +
  49 + $this.addClass('focus');
  50 + $curNav.removeClass('focus');
  51 +
  52 + $goods.not('.hide').addClass('hide');
  53 + $content = $goods.eq(index);
  54 + $content.removeClass('hide');
  55 +
  56 + $curNav = $this;
  57 +
  58 + $(document).trigger('scroll'); //Trigger lazyLoad
  59 +});
  60 +
31 //srcoll to load more 61 //srcoll to load more
32 $(window).scroll(function () { 62 $(window).scroll(function () {
33 if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) { 63 if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) {
34 -  
35 - // 没数据了,就不再加载  
36 if (loading) { 64 if (loading) {
37 return; 65 return;
38 } 66 }
39 -  
40 loading = true; 67 loading = true;
41 num = $goodList.children('.good-info').length; 68 num = $goodList.children('.good-info').length;
42 $.ajax({ 69 $.ajax({
@@ -50,7 +77,6 @@ $(window).scroll(function () { @@ -50,7 +77,6 @@ $(window).scroll(function () {
50 loading = true; 77 loading = true;
51 return; 78 return;
52 } 79 }
53 -  
54 $goodList.append(data); 80 $goodList.append(data);
55 81
56 //lazyLoad 82 //lazyLoad