Authored by ccbikai

首页头部swiper 圆点修改

1 var $ = require('yoho.zepto'), 1 var $ = require('yoho.zepto'),
2 Swiper = require('yoho.iswiper'), 2 Swiper = require('yoho.iswiper'),
3 - lazyLoad = require('yoho.zeptolazyload'); 3 + lazyLoad = require('yoho.zeptolazyload'),
  4 + tip = require('../../plugin/tip');
4 5
5 var $curNav, 6 var $curNav,
6 $navList = $('#discount-nav'), 7 $navList = $('#discount-nav'),
@@ -14,7 +15,32 @@ var swiper, @@ -14,7 +15,32 @@ var swiper,
14 loadMoreH = $('#load-more').height(), 15 loadMoreH = $('#load-more').height(),
15 loading = false, 16 loading = false,
16 page = 0, 17 page = 0,
17 - pd = ""; 18 + pd = '';
  19 +
  20 +/**
  21 + * 根据用户的选择获取商品折扣值
  22 + * @param int index
  23 + * @return string
  24 + */
  25 +function getSalePdByChoose(index) {
  26 + var pd = '0.1,0.3';
  27 +
  28 + switch (index) {
  29 + case 0:
  30 + pd = '0.1,0.3';
  31 + break;
  32 + case 1:
  33 + pd = '0.4,0.6';
  34 + break;
  35 + case 2:
  36 + pd = '0.7,0.9';
  37 + break;
  38 + case 3:
  39 + pd = '0.1,0.9';
  40 + break;
  41 + }
  42 + return pd;
  43 +}
18 44
19 // slide 个数大于 1 时,使用 swiper ,否则只显示单张图片 45 // slide 个数大于 1 时,使用 swiper ,否则只显示单张图片
20 if ($('.swiper-container .swiper-slide').length > 1) { 46 if ($('.swiper-container .swiper-slide').length > 1) {
@@ -57,7 +83,7 @@ $(window).scroll(function () { @@ -57,7 +83,7 @@ $(window).scroll(function () {
57 return; 83 return;
58 } 84 }
59 loading = true; 85 loading = true;
60 - 86 +
61 // num = $goodList.children('.good-info').length; 87 // num = $goodList.children('.good-info').length;
62 $.ajax({ 88 $.ajax({
63 type: 'GET', 89 type: 'GET',
@@ -76,8 +102,8 @@ $(window).scroll(function () { @@ -76,8 +102,8 @@ $(window).scroll(function () {
76 102
77 $goodList.append(data); 103 $goodList.append(data);
78 104
79 - //lazyLoad  
80 - //lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy')); 105 + // lazyLoad
  106 + // lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
81 lazyLoad($('.good-info').find('img.lazy')); 107 lazyLoad($('.good-info').find('img.lazy'));
82 108
83 loading = false; 109 loading = false;
@@ -91,28 +117,3 @@ $(window).scroll(function () { @@ -91,28 +117,3 @@ $(window).scroll(function () {
91 } 117 }
92 118
93 }); 119 });
94 -  
95 -/**  
96 - * 根据用户的选择获取商品折扣值  
97 - *  
98 - * @param int index  
99 - * @return string  
100 - */  
101 -function getSalePdByChoose(index) {  
102 - var pd = "0.1,0.3";  
103 - switch (index) {  
104 - case 0:  
105 - pd = "0.1,0.3";  
106 - break;  
107 - case 1:  
108 - pd = "0.4,0.6";  
109 - break;  
110 - case 2:  
111 - pd = "0.7,0.9";  
112 - break;  
113 - case 3:  
114 - pd = "0.1,0.9";  
115 - break;  
116 - }  
117 - return pd;  
118 -}  
@@ -56,8 +56,8 @@ $(window).scroll(function () { @@ -56,8 +56,8 @@ $(window).scroll(function () {
56 return; 56 return;
57 } 57 }
58 loading = true; 58 loading = true;
59 -  
60 - //num = $goodList.children('.good-info').length; 59 +
  60 + // num = $goodList.children('.good-info').length;
61 $.ajax({ 61 $.ajax({
62 type: 'GET', 62 type: 'GET',
63 url: '/product/newsale/selectNewSale', 63 url: '/product/newsale/selectNewSale',
@@ -73,8 +73,8 @@ $(window).scroll(function () { @@ -73,8 +73,8 @@ $(window).scroll(function () {
73 73
74 $goodList.append(data); 74 $goodList.append(data);
75 75
76 - //lazyLoad  
77 - //lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy')); 76 + // lazyLoad
  77 + // lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
78 lazyLoad($('.good-info').find('img.lazy')); 78 lazyLoad($('.good-info').find('img.lazy'));
79 79
80 loading = false; 80 loading = false;
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 margin: 0 (9rem / $pxConvertRem); 17 margin: 0 (9rem / $pxConvertRem);
18 border-radius: 50%; 18 border-radius: 50%;
19 } 19 }
20 - span.swiper-active-switch { 20 + span.swiper-pagination-bullet-active {
21 opacity: 1; 21 opacity: 1;
22 } 22 }
23 } 23 }