Showing
3 changed files
with
26 additions
and
14 deletions
@@ -425,7 +425,7 @@ const getPreBrandTopData = (args, type) => { | @@ -425,7 +425,7 @@ const getPreBrandTopData = (args, type) => { | ||
425 | preferenceBrands: { | 425 | preferenceBrands: { |
426 | name: title, | 426 | name: title, |
427 | imgBrand: [], | 427 | imgBrand: [], |
428 | - brandUrl: helpers.urlFormat('getbrandFloorDataAjax?channelType=' + type) | 428 | + brandUrl: '/getbrandFloorDataAjax?channelType=' + type |
429 | } | 429 | } |
430 | }; | 430 | }; |
431 | 431 | ||
@@ -794,7 +794,7 @@ const requestContent = type => { | @@ -794,7 +794,7 @@ const requestContent = type => { | ||
794 | limit: 1000 | 794 | limit: 1000 |
795 | }); | 795 | }); |
796 | 796 | ||
797 | - return serviceApi.get('/operations/api/v5/resource/home', data).then(res => { | 797 | + return serviceApi.get('operations/api/v5/resource/home', data).then(res => { |
798 | if (res.code === 200) { | 798 | if (res.code === 200) { |
799 | return res; | 799 | return res; |
800 | } else { | 800 | } else { |
This diff could not be displayed because it is too large.
@@ -7,28 +7,40 @@ exports.init = function(selector) { | @@ -7,28 +7,40 @@ exports.init = function(selector) { | ||
7 | var $imgBrand = $(selector); | 7 | var $imgBrand = $(selector); |
8 | var slider = $imgBrand.unslider({ | 8 | var slider = $imgBrand.unslider({ |
9 | autoplay: true, | 9 | autoplay: true, |
10 | - delay: 3000, | ||
11 | - arrows: { | ||
12 | - | ||
13 | - }, | ||
14 | - nav: false, | ||
15 | - animate: 'fade' | 10 | + delay: 5000, |
11 | + arrows: false, | ||
12 | + nav: false | ||
16 | }); | 13 | }); |
17 | var imgBrandNum = $imgBrand.find('li').length; | 14 | var imgBrandNum = $imgBrand.find('li').length; |
18 | - var rows = imgBrandNum / 3; | 15 | + var cols = imgBrandNum / 3; |
16 | + var changeSliderTimeout; | ||
19 | 17 | ||
20 | if (!($imgBrand.find('li').length % 3)) { | 18 | if (!($imgBrand.find('li').length % 3)) { |
21 | - rows -= 1; | 19 | + cols -= 1; |
22 | } | 20 | } |
23 | 21 | ||
24 | $imgBrand.find('li:nth-child(3n)').css('margin-right', 0); | 22 | $imgBrand.find('li:nth-child(3n)').css('margin-right', 0); |
25 | 23 | ||
26 | slider.on('unslider.change', function(event, index) { | 24 | slider.on('unslider.change', function(event, index) { |
27 | - if (index > rows) { | ||
28 | - slider.unslider('animate:' + imgBrandNum); | ||
29 | - slider.unslider('animate:first'); | 25 | + clearTimeout(changeSliderTimeout); |
26 | + if (index >= cols) { | ||
27 | + changeSliderTimeout = setTimeout(function() { | ||
28 | + slider.unslider('animate:first'); | ||
29 | + }, 4999); | ||
30 | } | 30 | } |
31 | }); | 31 | }); |
32 | 32 | ||
33 | - // TODO: 手动点击左右 | 33 | + $('.img-brand-switch').on('click', '.prev', function() { |
34 | + if (slider.data('unslider').current > cols || slider.data('unslider').current <= 0) { | ||
35 | + slider.unslider('animate:' + cols); | ||
36 | + } else { | ||
37 | + slider.unslider('prev'); | ||
38 | + } | ||
39 | + }).on('click', '.next', function() { | ||
40 | + if (slider.data('unslider').current >= cols) { | ||
41 | + slider.unslider('animate:first'); | ||
42 | + } else { | ||
43 | + slider.unslider('next'); | ||
44 | + } | ||
45 | + }); | ||
34 | }; | 46 | }; |
-
Please register or login to post a comment